health-check, you can enable sync policies:
- Auto‑Sync: Argo CD watches the Git repository and automatically applies detected manifest changes to the cluster (no manual sync required).
- Self‑Heal: If a resource is changed or deleted directly in the cluster (out‑of‑band), Argo CD will attempt to reconcile the resource back to the manifest in Git.
- Prune Resources: When a resource is removed from Git, Argo CD will delete the corresponding resource from the cluster on the next sync.
When Auto‑Sync is enabled, Argo CD applies changes detected in Git automatically. Self‑Heal reconciles manual cluster changes to match Git. Prune removes cluster resources that were removed from Git. With Auto‑Sync + Self‑Heal + Prune enabled, resources present in Git will be recreated if manually deleted, while resources removed from Git will be deleted from the cluster.
1) Auto‑Sync — automatically apply updates from Git
To see Auto‑Sync in action, change the Deployment manifest in your Git repository (for example, increase replicas from 1 to 2). Example Deployment manifest:- Commit and push the change to the repository.
- With Auto‑Sync enabled on the
health-checkapplication, Argo CD will detect the change and apply it automatically.
2) Self‑Heal — Argo CD reconciles manual cluster changes
If Self‑Heal is enabled and you manually delete or modify a resource in the cluster, Argo CD will detect the divergence and restore the resource to match the manifest in Git. Example sequence deleting a Service:3) Prune Resources — remove resources from the cluster when removed from Git
When you remove a manifest from Git and have Auto‑Sync with Prune enabled, Argo CD will delete the corresponding cluster resource during the next sync. Example outcome after removing the Service manifest and allowing Auto‑Sync + Prune to take effect:Quick reference — behavior comparison
Use combinations of these options to match your operational model: continuous delivery with self‑correction (Auto‑Sync + Self‑Heal + Prune), or a more controlled/manual approach (disable Auto‑Sync and trigger syncs manually).
Summary
- Auto‑Sync automatically applies Git changes to the cluster.
- Self‑Heal reconciles and restores resources when manual modifications occur in the cluster.
- Prune Resources removes cluster resources when they are deleted from Git.
- Combine these policies to implement the GitOps workflow that fits your environment.