GitOps
Definition
GitOps is an operational framework that takes DevOps best practices (version control, collaboration, change audit, immutability) and applies them to infrastructure and application deployment. The Git repository is the single source of truth for desired system state.
Changes to infrastructure or applications are made by updating Git manifests. An operator (controller) continuously reconciles the live state with the Git state, applying or reverting changes automatically.
GitOps Principles
- Declarative: Infrastructure described in code (YAML manifests)
- Version Controlled: All changes tracked in Git with history
- Audited: Every change has a commit message and author
- Automated: Automatic reconciliation of live state to desired state
- Pull-based: Cluster pulls from Git (not pushed to by CI)
GitOps Workflow
Developer → Pull Request → Code Review → Merge → Git
↓
GitOps Operator
↓
Cluster State
(auto-reconciled)
GitOps Tools
| Tool | Type | Notes |
|---|---|---|
| Argo CD | Kubernetes | Most popular GitOps tool for K8s |
| Flux CD | Kubernetes | CNCF project, simpler than Argo CD |
| Atlantis | Terraform | GitOps for Terraform state |
| Drift Controller | Kubernetes | Detects and reports drift |
| Weave GitOps | Multi-cluster | Unified GitOps management |
GitOps vs Traditional CI/CD
| Aspect | Traditional CI/CD | GitOps |
|---|---|---|
| Deployment trigger | CI pipeline push | Git change + pull-based |
| State source | CI server | Git repository |
| Cluster access | CI pushes to cluster | Cluster pulls from Git |
| Drift detection | Manual | Automatic (continuous) |
| Rollback | Manual pipeline | Revert commit, auto-revert |
GitOps Benefits
- Audit trail: Every change has Git history
- Rollback: Git revert = instant rollback
- Drift detection: Automatic detection of config drift
- Security: No cluster credentials exposed to CI
- Collaboration: PR-based change management
- Disaster recovery: Rebuild from Git manifests
GitOps Limitations
- Learning curve: Requires Git and YAML proficiency
- Complexity: Not suitable for simple deployments
- Latency: Reconciliation is not instant (seconds to minutes)
- Scope: Primarily for Kubernetes; other platforms have limited support
Related Terms
- Terraform
- Argo CD — leading GitOps tool for Kubernetes
- Kubernetes — traditional deployment pipeline
- Helm — K8s package manager, often used with GitOps
- Flux — CNCF GitOps tool
References
- GitOps.tech: https://www.gitops.tech/
- Argo CD docs: https://argoproj.github.io/cd/
- Flux docs: https://fluxcd.io/
- CNCF GitOps Whitepaper: https://www.cncf.io/whitepapers/gitops/