GitOps
Git Repo
🐙
replicas: 3
ArgoCD
✅
Cluster
GitOps is a set of practices to manage infrastructure and application configurations using Git as the single source of truth.
1. The Pull Model vs The Push Model
Traditional CI/CD (Push)
- Developer commits code.
- CI (Jenkins/GitHub Actions) builds image.
- CI runs
kubectl apply -f deploy.yaml.
The "Drift" Problem: If an engineer runs kubectl edit deployment manually to fix a production fire, the Cluster and Git are now different. The next time the CI runs, it might overwrite the manual fix, or worse, the fix is never documented in Git.
GitOps (Pull)
- Developer commits code.
- CI builds image and commits the new tag to a Config Repo (e.g.,
values.yaml). - GitOps Operator (ArgoCD) running inside the cluster sees the change in Git.
- ArgoCD pulls the change and applies it to the cluster.
Self-Healing: ArgoCD constantly compares Git to the Cluster. If it detects "Drift" (a manual change), it can automatically revert the cluster to match Git, ensuring Git remains the undisputed source of truth.
Tools
- ArgoCD: Visual dashboard, very popular.
- Flux: Headless, highly integrated with Helm.
💬 Feedback & Comments
Have a question or found a bug? Leave a comment below using your GitHub account.