1. Setting up Environments with Terraform: Begin by using Terraform to define and create your Kubernetes clusters for production and QA environments. Terraform allows you to automate the infrastructure setup.23
  2. CI Pipeline and Artifact Upload: Your Continuous Integration (CI) pipeline builds and uploads artifacts to a container registry like Ghcr after code changes. This step involves building and pushing new container images automatically when changes occur in your application code.13
  3. Argo CD Deployment: Argo CD continuously monitors the Git repositories containing your Kubernetes manifests. When changes are detected in the repository, Argo CD automatically synchronizes the live state of the cluster with the desired state defined in Git. It ensures that the applications are deployed and maintained according to the defined configuration.13
  4. Comparison and Deployment: Argo CD compares the current state of the cluster with the desired state specified in the Git repository. If there are discrepancies, Argo CD initiates the necessary actions to bring the cluster back to the desired state. This may involve deploying new versions of applications or updating configurations as needed.

Here’s a breakdown of the different repositories and their roles:

  1. Application Code Repository: This repository contains the source code for your application. This is where your developers commit and push their code changes.
  2. Terraform Manifests Repository: This repository contains the Terraform configuration files that define your Kubernetes infrastructure, such as clusters, namespaces, and other resources. This is a separate repository from the application code.
  3. Kubernetes Manifests Repository: This repository contains the Kubernetes YAML manifests that define the deployment of your application, such as Deployments, Services, and ConfigMaps. This is also a separate repository from the application code and Terraform manifests.

The flow typically works as follows:

  1. Developers commit and push changes to the Application Code Repository.
  2. The CI/CD pipeline detects the changes, builds a new container image, and pushes it to a container registry (e.g., GitHub Container Registry).
  3. Argo CD monitors the Kubernetes Manifests Repository and detects the changes in the container image reference.
  4. Argo CD then compares the desired state defined in the Kubernetes Manifests Repository with the current state of the Kubernetes cluster and applies the necessary changes to deploy the new version of the application.

Refs