GitOps with ArgoCD: Treating Git as the Single Source of Truth
· Sourabh G Kulkarni
Why pull-based continuous delivery beats push-based pipelines, drift detection, self-healing sync, and multi-cluster management with ApplicationSets.

For years, the standard deployment pipeline was Push-based: a CI runner (Jenkins, GitHub Actions, or GitLab CI) built a Docker container, ran tests, and then executed kubectl apply -f deployment.yaml directly against the Kubernetes production API.
While functional, push-based continuous delivery introduces serious challenges:
- Security Vulnerability: The external CI runner must possess full cluster-admin credentials to reach the Kubernetes API.
- Configuration Drift: If an engineer manually modifies a replica count or environment variable using
kubectl edit, the CI pipeline has no idea. Git and production are no longer in sync.
GitOps flips this model from Push to Pull: an in-cluster agent (like ArgoCD) continuously monitors Git and pulls declarative state into the cluster.
flowchart LR
Dev["Developer"]
subgraph Git["Git Repository (Single Source of Truth)"]
Manifests["Helm / Kustomize Manifests (Target State)"]
end
subgraph Cluster["Kubernetes Production Cluster"]
Argo["ArgoCD Controller (Pull Agent)"]
LiveState["Live K8s Resources (Current State)"]
Pods["Running Application Pods"]
end
Dev -->|git commit & push| Manifests
Argo -->|1. Poll / Webhook (Read target state)| Manifests
Argo -->|2. Diff with Live State| LiveState
Argo -->|3. Auto-Sync & Self-Heal| LiveState
LiveState --> Pods
1. The Core Benefits of GitOps
- Pull-Based Security: No external system holds inbound cluster credentials. ArgoCD runs inside your cluster and pulls outward from Git via read-only repository access.
- Continuous Drift Detection & Self-Healing: If someone runs
kubectl delete deployment api, ArgoCD immediately detects the difference between Git and the cluster and recreates the deployment within seconds. - Instant Rollbacks: Rolling back a deployment is as simple as running
git revert <commit-sha>.
2. Anatomy of an ArgoCD Application
An ArgoCD Application custom resource defines the bridge between a Git repository and a destination cluster namespace:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: payment-service
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: https://github.com/sourabhkulkarni/gitops-manifests.git
targetRevision: main
path: environments/production/payment-service
destination:
server: https://kubernetes.default.svc
namespace: payments
syncPolicy:
automated:
prune: true # Automatically delete resources in k8s if removed from Git
selfHeal: true # Automatically overwrite manual out-of-band kubectl edits
syncOptions:
- CreateNamespace=true
3. Scaling to Multiple Clusters with ApplicationSets
Managing 50 microservices across Dev, Staging, and Multi-Region Production clusters individually creates YAML bloat.
ArgoCD ApplicationSets use generators to dynamically spawn Applications:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: cluster-addons
namespace: argocd
spec:
generators:
- list:
elements:
- cluster: us-east-1-prod
url: https://api.prod-east.company.internal
- cluster: eu-west-1-prod
url: https://api.prod-west.company.internal
template:
metadata:
name: '{{cluster}}-monitoring'
spec:
project: default
source:
repoURL: https://github.com/company/infra-charts.git
targetRevision: v2.4.0
path: charts/monitoring
destination:
server: '{{url}}'
namespace: monitoring
GitOps transforms deployments into an audited, pull-based workflow where your Git commit log serves as your definitive production deployment history.