DEV Community

Cover image for 🎯 Task #3 β€” Enable AutoSync + Health Checks + Self-Heal in ArgoCD
Latchu@DevOps
Latchu@DevOps

Posted on

🎯 Task #3 β€” Enable AutoSync + Health Checks + Self-Heal in ArgoCD

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

1

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
Enter fullscreen mode Exit fullscreen mode

Push it:

git add .
git commit -m "Update version"
git push
Enter fullscreen mode Exit fullscreen mode

Expected result:

  • ArgoCD UI shows "OutOfSync β†’ Syncing β†’ Healthy"
  • New image deployed automatically

2

If you check with pods,

3


⭐ Step 3 β€” Test Self-Heal (Drift Correction)

Modify something manually in the cluster:

kubectl edit deploy demo-app
Enter fullscreen mode Exit fullscreen mode

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.

4


⭐ Step 4 β€” Test Auto-Rollback

Break the deployment:

Edit your deployment.yaml and use a fake image:

image: nginx:does-not-exist
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

➑️ ArgoCD will detect the file removed
➑️ It will delete the Service in Kubernetes automatically

5


πŸŽ‰ 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 |
Enter fullscreen mode Exit fullscreen mode

🌟 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)