Skip to main content

GitOps with ArgoCD

Why GitOps Was Born

Picture a library. Every book has a catalog entry, and librarians ensure shelves match the catalog. If someone sneaks in and rearranges books, chaos erupts. Kubernetes faced the same challenge: manual changes to clusters caused drift, errors, and outages.

GitOps was born as the library catalog system of Kubernetes, ensuring the cluster always matches the desired state stored in Git.


GitOps Principles

  • Declarative: Desired state is defined in Git (YAML manifests).
  • Versioned: Git tracks every change with history.
  • Automated: Tools continuously reconcile cluster state with Git.
  • Auditable: Every change is reviewed and approved via pull requests.
Analogy: GitOps is like librarians checking shelves against the catalog and if books are missing or misplaced, they fix it.

Tools for GitOps

  • ArgoCD:
    • Kubernetes‑native GitOps controller.
    • Syncs cluster state with Git repositories.
    • Provides UI and CLI for visualization.
Analogy: ArgoCD is like a digital librarian, constantly scanning shelves and correcting mismatches.
  • Flux:
    • Lightweight GitOps toolkit.
    • Focuses on simplicity and automation.
    • Integrates with Helm and Kustomize.
Analogy: Flux is like a minimalist librarian, quietly keeping shelves in order without fuss.

Global Context

  • Enterprises: Use GitOps for compliance, auditability, and faster deployments.
  • Cloud Providers: Offer GitOps integrations (e.g. Azure Arc with Flux, AWS App Manager with ArgoCD).
  • Community: GitOps is a CNCF‑endorsed practice, rapidly becoming the standard for Kubernetes operations.

Hands‑On Exercise

  1. Reflect: How does GitOps act as the catalog system, ensuring clusters always match the source of truth in Git?

Deploy an application via GitOps:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: web-app
  namespace: argocd
spec:
  source:
    repoURL: https://github.com/myorg/k8s-apps.git
    path: web
    targetRevision: HEAD
  destination:
    server: https://kubernetes.default.svc
    namespace: default
  syncPolicy:
    automated:
      prune: true
      selfHeal: true

Connect ArgoCD to a Git repository:

argocd repo add https://github.com/myorg/k8s-apps.git

Install ArgoCD:

kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

The Hacker’s Notebook

  • GitOps is declarative and Git defines desired state.
  • ArgoCD is the feature‑rich digital librarian.
  • Flux is the simple, automated minimalist librarian.
  • Lesson for engineers: Don’t drift and let GitOps enforce consistency.
  • Hacker’s mindset: Treat Git as your single source of truth. With GitOps, you can scale deployments globally with confidence.

Tips, Tricks, Roadmaps, Resources, Networking, Motivation, Guidance, and Cool Stuff ♥

Updated on Dec 30, 2025