# GitOps
GitOps is an operational framework that uses [[Git]] as the single source of truth for declarative infrastructure and application configuration. Changes to infrastructure or deployments are made via Git commits and pull requests — not manual commands or direct server access.
## Core principles
- **Declarative**: The entire system state is described declaratively (e.g., Kubernetes manifests, Terraform configs)
- **Versioned**: All desired state is stored in Git — full history, auditability, rollback
- **Automated**: An automated agent continuously reconciles actual state with desired state
- **Observable**: Any drift between Git state and live state is detected and can trigger alerts or auto-correction
## How it works
1. Developer opens a PR with config/infra changes
2. PR is reviewed and merged into the main branch
3. A GitOps operator (e.g., Flux, ArgoCD) detects the change
4. The operator applies the change to the target environment automatically
5. If live state drifts from Git state, the operator reconciles
## GitOps vs traditional ops
| | Traditional | GitOps |
|---|---|---|
| Source of truth | Servers / manual | Git |
| Changes via | SSH, scripts, UI | Pull requests |
| Rollback | Manual / risky | `git revert` |
| Auditability | Logs (if any) | Full Git history |
## Common tools
- **ArgoCD** — Kubernetes-native GitOps controller
- **Flux** — CNCF GitOps operator for Kubernetes
- **Terraform + Git** — IaC GitOps for cloud infra
## References
-
## Related
- [[Git]]
- [[DevOps]]
- [[CI CD pipelines]]
- [[Infrastructure as Code (IaC)]]
- [[Kubernetes]]