EN_CS_GitOps - somaz94/DevOps-Engineer GitHub Wiki
Q8: What is GitOps?
Question: Explain GitOps core principles and how ArgoCD automates Kubernetes deployments. Focus on the Declarative approach and the Reconciliation Loop.
Key Terms
Term
Description
GitOps
Operational model using Git as the Single Source of Truth
Declarative
Define what the desired state is (not how to get there)
Imperative
Issue commands to reach a state step by step
Reconciliation
Process of making actual state match desired state
ArgoCD
Kubernetes-native GitOps CD tool
Flux
CNCF Graduated GitOps tool
Sync
Applying Git state to the cluster
Self-heal
Auto-restoring Git state when manual changes are detected
GitOps 4 Core Principles
Principle
Description
Declarative
System desired state is declared, not commanded
Versioned & Immutable
All changes tracked in Git; rollback anytime
Pulled Automatically
Agent continuously monitors Git; auto-deploys on change
Continuously Reconciled
Detects drift between actual and desired state; auto-corrects
Traditional CI/CD vs GitOps
Traditional CI/CD:
Git Commit → CI Build → kubectl apply → Kubernetes
Problem: requires kubectl access, Git and live state can diverge
GitOps (ArgoCD):
Git Commit → CI Build → Container Registry
↓
Git Manifest Repo ← ArgoCD polling → Kubernetes auto-sync
Benefit: only Git access needed; Git always = live state
Reconciliation Loop
1. Observe → Read Desired State from Git (replicas: 3)
↓
2. Diff → Read Actual State from Kubernetes (running: 2)
Desired ≠ Actual → Out of Sync
↓
3. Act → Run kubectl apply, create 1 Pod
↓
4. Verify → Re-check state (running: 3) → Synced
↓
Repeat (every 3 minutes by default)