ArgoCD is powerful because it continuously watches Git and your cluster, and keeps them in sync.
This task enables:
β Auto-Sync
Automatically apply changes from Git to the cluster.
β Self-Heal
If someone manually edits or deletes a Kubernetes object, ArgoCD restores it from Git.
β Auto-Prune
Remove Kubernetes resources that were removed from Git.
β Rollbacks
If a sync fails, ArgoCD will automatically roll back to a good version.
β Step 1 β Enable AutoSync in ArgoCD UI
Go to:
Applications β Select your app β App Details β Sync Policy
Turn ON:
- Auto-Sync
- Prune Resources
- Self Heal
These correspond to:
| Setting | Meaning |
|---|---|
| Auto-Sync | If Git changes, ArgoCD automatically applies the changes to the cluster. |
| Prune | If a file (resource) is deleted from Git, ArgoCD deletes that resource from the cluster. |
| Self-Heal | If someone manually changes something in the cluster (via kubectl), ArgoCD restores it back to match Git. |
β Step 2 β Verify AutoSync is Working
(1) Update something in Git
Edit your deployment.yaml image tag:
image: nginx:1.27
Push it:
git add .
git commit -m "Update version"
git push
Expected result:
- ArgoCD UI shows "OutOfSync β Syncing β Healthy"
- New image deployed automatically
If you check with pods,
β Step 3 β Test Self-Heal (Drift Correction)
Modify something manually in the cluster:
kubectl edit deploy demo-app
Change replicas from 2 to 5 and save.
β‘οΈ ArgoCD will detect drift
β‘οΈ ArgoCD will automatically revert replicas back to the Git value (e.g. 2)
This proves self-heal is working.
β Step 4 β Test Auto-Rollback
Break the deployment:
Edit your deployment.yaml and use a fake image:
image: nginx:does-not-exist
Push it.
Expected:
- ArgoCD tries to sync
- Sync fails
- ArgoCD rollback mechanism applies the last healthy version automatically (using retry + failure detection)
Your app will remain healthy π
β Step 5 β Test Auto-Prune
Delete the service from GitHub:
rm service.yaml
git add .
git commit -m "Remove service"
git push
β‘οΈ ArgoCD will detect the file removed
β‘οΈ It will delete the Service in Kubernetes automatically
π Final Result β What You Achieved
With Task #3 completed, your app now has:
| Feature | Status |
| ------------------------------------------- | --------- |
| Automatic Git β Cluster sync | β
Enabled |
| Automatically revert manual kubectl changes | β
Enabled |
| Automatically delete removed resources | β
Enabled |
| Automatic rollback to last good version | β
Enabled |
| Continuous health monitoring | β
Enabled |
π Thanks for reading! If this post added value, a like β€οΈ, follow, or share would encourage me to keep creating more content.
β Latchu | Senior DevOps & Cloud Engineer
βοΈ AWS | GCP | βΈοΈ Kubernetes | π Security | β‘ Automation
π Sharing hands-on guides, best practices & real-world cloud solutions





Top comments (0)