What does the prune option do in a sync policy?
Short answer
Prune deletes live resources that no longer exist in Git, keeping the cluster exactly matching the desired state. Without prune, removing a manifest from Git leaves the resource running (orphaned).
Advertisement
AModel answer
Prune deletes live resources that no longer exist in Git, keeping the cluster exactly matching the desired state. Without prune, removing a manifest from Git leaves the resource running (orphaned). Prune is powerful but should be used carefully; resources can be protected from pruning with annotations.
syncPolicy:
automated:
prune: true
# Protect a resource from pruning:
metadata:
annotations:
argocd.argoproj.io/sync-options: Prune=falseReal-world example
After a service is deleted from Git, prune removes its Deployment and Service from the cluster automatically.
Likely follow-ups
- What happens without prune? | How do you protect a resource from pruning?
Related topics