This content originally appeared on DEV Community and was authored by Latchu@DevOps
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
This content originally appeared on DEV Community and was authored by Latchu@DevOps
Latchu@DevOps | Sciencx (2025-11-27T12:49:52+00:00) 🎯 Task #3 — Enable AutoSync + Health Checks + Self-Heal in ArgoCD. Retrieved from https://www.scien.cx/2025/11/27/%f0%9f%8e%af-task-3-enable-autosync-health-checks-self-heal-in-argocd/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.




