GitOps with ArgoCD

GitOps with ArgoCD

I’m learning a set of new tools to make my skills more well-rounded. These include Azure, Terraform and ArgoCD. ArgoCD is a GitOps continuous delivery tool for Kubernetes that’s similar to Flux CD, which I used in my Kubernetes homelab. Like Flux CD, it syncs your cluster with configuration data stored in Git. The way it works is that you push changes to Git and Argo CD picks them up and applies them to the cluster. Git becomes the single source of truth. If the cluster drifts from what’s in Git, Argo CD can either alert you or automatically sync to fix it.

Installing Argo CD

I installed Argo CD using Helm:

helm repo add argo https://argoproj.github.io/argo-helm
helm repo update

kubectl create namespace argocd
helm install argocd argo/argo-cd --namespace argocd

Accessing the UI

Unlike Flux CD which is CLI-first, Argo CD is a UI-first application. After installing it in the cluster, I accessed the argocd-server by port forwarding using this command:

kubectl port-forward svc/argocd-server -n argocd 8080:443

This command lets me tunnel securely into the Argo CD pod from my local machine without setting up an ingress or load balancer. This is a screenshot from the Argo CD UI:

Getting the Default Admin Password

Before I could login to the UI, I had to get the default admin password from the secret that was created during installation:

kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath="{.data.password}" | base64

Key Concept: The Application Object

So far, I’ve learned that the heart of Argo CD is the Application object. It defines a

  • Source : A Git repo with source files (Helm charts, Kustomize files or plain YAML manifests)
  • Destination: The target Kubernetes cluster and namespace
  • Sync Policy: Whether or not this application should be manually or automatically synced to the cluster.

Below is an example of an ArgoCD Application to deploy Nginx via Helm:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: nginx-helm
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://charts.bitnami.com/bitnami
    chart: nginx
    targetRevision: 15.3.2
    helm:
      values: |
        service:
          type: LoadBalancer
  destination:
    server: https://kubernetes.default.svc
    namespace: default
  syncPolicy:
    automated:
      prune: true
      selfHeal: true

This config tells Argo CD to watch the Bitnami Nginx chart and auto-deploy changes.

Thoughts so far

Argo CD was quick to install–I had it up and running in a few minutes. The UI is clean and easy to use. I haven’t explored the CLI yet, but I’ll test it as I deploy more applications. So far, it feels straightforward and promising.

Leave a Comment

Your email address will not be published. Required fields are marked *