DevOps Peach

GitOps with Argo CD · GitOps and Argo CD Basics · Lesson 1 of 4

What is GitOps

GitOps runs a system from a Git repository: the desired state is declared in Git, and an agent in the cluster keeps pulling and reconciling the real state towards it.

Practice interactively →

Without GitOps, a CI job usually ends with kubectl apply or helm upgrade run against the cluster. It works, but the pipeline needs cluster admin credentials, nobody can tell whether the cluster still matches what was deployed, and a manual kubectl edit at 2 a.m. is invisible.

GitOps turns this around. The desired state of every environment lives in a Git repository, and an agent inside the cluster compares it with the live state and fixes any difference.

The four OpenGitOps principles

Principle What it means in practice
Declarative The system is described as data (YAML, Helm values, Kustomize), not as a script of steps.
Versioned and immutable That description is stored in Git: every change is a commit with an author, a review and a history.
Pulled automatically An agent in the cluster pulls the desired state; nobody pushes into the cluster from outside.
Continuously reconciled The agent keeps comparing desired and live state and corrects drift.
flowchart LR
  D["Developer"] -->|"pull request"| G["Git: shop-config"]
  CI["CI: build, test, push image"] -->|"bump image tag"| G
  A["Argo CD in the cluster"] -->|"pull every 3 min"| G
  A -->|"apply the difference"| K["Kubernetes"]

Push vs pull

Push (classic CD) Pull (GitOps)
Who changes the cluster The CI server An agent in the cluster
Credentials CI holds cluster credentials Only the agent has cluster access; CI only writes to Git
Drift (manual change) Unnoticed Shown as OutOfSync, can be reverted automatically
Rollback Re-run an old pipeline git revert the commit
Audit Pipeline logs Git history and pull requests

Two repositories, two jobs

Most teams split the work:

This keeps a stream of code commits from triggering deployments by accident and gives the config repo its own reviewers.

Where Argo CD fits

Argo CD is a GitOps controller for Kubernetes and a CNCF graduated project. It watches Git repositories, renders manifests (plain YAML, Helm, Kustomize, Jsonnet), compares them with the cluster, shows the difference in a web UI and CLI, and syncs the cluster — manually or automatically. Flux is the other well-known GitOps tool; the ideas in this course apply to both.

What GitOps does not do

Rule of thumb: if a change is not in Git, it should not exist in the cluster.

Practice interactively →