Overview
GitOps treats Git as the control plane. Instead of a pipeline running kubectl apply against production, a controller inside the cluster watches a repository and makes reality match it. Every change is a commit, which gives review, attribution and history for free.
How it works
The CI pipeline builds and tests an image, then opens a commit in the config repository that bumps the image tag. A reconciler pulls that repository on an interval or webhook, renders the manifests, diffs them against the live cluster and applies the delta.
app repo --CI--> image registry
|
config repo <-- commit: tag bump
^
| pull
reconciler (in cluster) --apply--> live state
|
+-- drift detected --> revert or alert
Rollback is reverting the commit; the reconciler converges to the previous state.
Pitfalls
- Committing plain secrets. Use sealed secrets, SOPS or an external secret operator.
- One repository branch for all environments, which turns every merge into a production deploy. Use directories or branches per environment with explicit promotion.
- Automatic pruning enabled without safeguards, deleting resources that were created out of band.
- Ignoring reconciler health. If it is down, drift accumulates unnoticed, so alert on sync failures and age of last successful sync.
- Treating Git latency as acceptable during incidents without a documented break-glass path.
Key takeaways
- Git holds desired state, the cluster pulls it, and drift gets corrected.
- Rollback and audit become ordinary Git workflows.
- Keep application code and environment config separate.
- Solve secrets and promotion before adopting it widely.
- Monitor the reconciler as production infrastructure.