Argo CD

Argo CD

It is a highly popular, declarative, and GitOps-based Continuous Delivery (CD) tool specifically designed for Kubernetes.

Argo CD does not handle Continuous Integration (CI) tasks like building code and running unit tests—it focuses exclusively on the deployment phase of the pipeline.

Key Features and Principles of Argo CD

Argo CD’s core philosophy is GitOps, which uses a Git repository as the single source of truth for the desired state of your application and infrastructure.

1. Declarative Continuous Delivery (CD)

  1. Kubernetes-Native: Argo CD runs as a controller inside your Kubernetes cluster. It is aware of Kubernetes resources (Pods, Services, Deployments, etc.).
  2. Git as Source of Truth: The Kubernetes manifests (YAML, Helm charts, Kustomize files) that define the desired state of your application are stored in a Git repository.
  3. Pull-Based Deployment: Instead of an external CI tool “pushing” changes into the cluster, Argo CD actively “pulls” the desired state from the Git repository and applies it to the cluster. This is often considered more secure.

2. Continuous Synchronization and Drift Detection

  1. Automatic Sync: Argo CD continuously monitors the Git repository for changes. When a new commit is detected, it automatically begins the process of synchronizing the cluster’s live state to match the declared state in Git.
  2. Configuration Drift: It also monitors the live state of the cluster. If someone bypasses Argo CD and makes a manual change using the `kubectl` CLI (creating a “snowflake” cluster), Argo CD detects this configuration drift and can automatically revert the unauthorized change to match the configuration defined in Git.

3. Visibility and Management

  1. Web UI and CLI: Argo CD offers a modern web interface that provides a real-time, interactive visualization of your deployed applications, health status, and resources (pods, services, etc.).
  2. Rollbacks: It enables easy, integrated rollbacks to any previous committed version in Git, providing a quick recovery path if a deployment fails.
  3. Multi-Cluster Support: It can manage and deploy applications to multiple Kubernetes clusters from a single Argo CD installation.

How Argo CD Works in a CI/CD Pipeline

Argo CD typically sits at the end of the overall CI/CD pipeline, complementing a CI tool like GitHub Actions, Jenkins, or CircleCI:

  1. CI Phase (e.g., GitHub Actions):
    1. Developer pushes code to the Application Repository.
    2. GitHub Actions runs tests, linting, and builds the Docker container image.
    3. The action pushes the new image to a Container Registry (e.g., Docker Hub, GHCR).
  2. Handoff/CD Trigger:
    1. The GitHub Actions workflow then updates the image tag inside the Configuration Repository (the Git repo that Argo CD watches).
    2. This update is a new commit to the GitOps repo.
  3. CD Phase (Argo CD):
    1. Argo CD detects the new commit in the Configuration Repository.
    2. It pulls the new configuration (with the updated image tag).
    3. It applies the changes to the Kubernetes cluster, deploying the new version of the application.

This separation of concerns - CI builds and tests, while CD deploys and manages state - is considered a modern DevOps best practice.

If you’d like to see a tutorial on how to combine the two tools, you can find more information in this video on Kubernetes CI/CD using ArgoCD and Github Actions. This video demonstrates building a Kubernetes CI/CD pipeline using ArgoCD and GitHub Actions. http://googleusercontent.com/youtube_content/0