After this lesson, you will be able to: Explain the GitOps model and use Argo CD to sync a Kubernetes cluster to a Git repo, plus where Infrastructure as Code fits in the pipeline.
Push-based pipelines run kubectl apply from CI, which means your CI system holds cluster credentials and nobody really knows what is running. GitOps inverts this: Git is the single source of truth for the desired state, and an in-cluster agent (Argo CD or Flux) continuously pulls and reconciles. This lesson covers the model, a real Argo CD setup, and how IaC (Terraform) relates.
In a push pipeline, CI builds the image and then runs kubectl apply / helm upgrade against the cluster. The cluster is a passive target and your CI runner must hold powerful cluster credentials. In GitOps (pull), a desired-state manifest lives in a Git repo, and an agent running inside the cluster watches that repo and applies any change. CI's job shrinks to: build the image, then commit the new image tag to the config repo. The agent does the rest. Nobody runs kubectl by hand against production.
Git is the source of truth: every change to production is a commit, so you get review (pull requests), history (git log), and instant rollback (git revert). Drift detection: the agent constantly compares the live cluster to Git and flags or auto-corrects anything that drifted (a hand-edited resource, a deleted pod config). Least privilege: cluster credentials never leave the cluster, so a compromised CI runner cannot touch production directly. Auditability: 'what is running in prod?' is answered by reading one repo, not by interrogating the cluster.
Argo CD watches a Git path and syncs it to a cluster. This manifest points Argo CD at your config repo.
# install Argo CD into the cluster (once):# kubectl create namespace argocd# kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml# app-of-apps style: an Application tells Argo CD what to syncapiVersion: argoproj.io/v1alpha1kind: Applicationmetadata:name: store-webnamespace: argocdspec:project: defaultsource:repoURL: https://github.com/acme/store-config.git # the CONFIG repotargetRevision: mainpath: apps/store-web # Helm or plain manifestsdestination:server: https://kubernetes.default.svcnamespace: storesyncPolicy:automated:prune: true # delete resources removed from GitselfHeal: true # revert manual drift back to Git's statesyncOptions:- CreateNamespace=true
How a code change reaches production without anyone touching the cluster.
Developer merges a feature PR into the app repo.
CI builds and pushes a new image, e.g. ghcr.io/acme/store-web:sha-abc123.
CI opens (or commits) a one-line change to the CONFIG repo bumping the image tag to sha-abc123.
That config change is reviewed and merged (this merge IS the production approval).
Argo CD detects the new commit, syncs it, and rolls out the new image.
If anything is wrong, git revert the config commit; Argo CD rolls back automatically.
Pick the best description.
Sign in and purchase access to unlock this lesson.