GitOps with Argo CD and Flux
GitOps is a modern deployment model where Git is the single source of truth for the desired cluster state. Tools like Argo CD and Flux continuously synchronize the cluster state with what’s declared in Git.
GitOps Principles:
- Everything is version-controlled in Git (including Kubernetes manifests)
- Automatic reconciliation between Git and cluster state
- Declarative deployments, easier rollback, and audit trails
Popular GitOps Tools:
- Argo CD: GUI, CLI, and Git-driven sync engine
- Flux: Lightweight and integrates well with existing pipelines
Argo CD Setup Example:
# Create Argo CD namespace
kubectl create namespace argocd
# Install Argo CD
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# Forward port to access UI
kubectl port-forward svc/argocd-server -n argocd 8080:443
GitOps Workflow:
- Declare Kubernetes resources in Git repo
- Argo CD watches the repo and applies changes
- Cluster stays in sync with Git automatically