After enabling `prune: true`, someone renames a folder and the next sync would delete a production StatefulSet and its PVCs. How do you prevent this class of incident?
AdvancedScenarioSync Behaviour, Waves & Hooks
Answer
Situation read → Prune turns a refactoring mistake into data loss.
What I'd do →
- Annotate stateful resources and PVCs with
argocd.argoproj.io/sync-options: Prune=false,Delete=false. - Keep
allowEmpty: falseso an empty render cannot wipe an app. - Add a CI check that runs
argocd app diff --localor renders and compares resource counts on PRs to the config repo. - Use
Prune=confirmon critical resources so pruning needs a human click. - Set StorageClass
reclaimPolicy: Retainfor important volumes.
Why → Defense in depth: GitOps automation should never be the only barrier before deleting data.
Interview tip → Mention PV Retain as the last line of defense.
More on Sync Behaviour, Waves & Hooks
A new release needs a database migration that must finish before the new pods start. How do you implement it in Argo CD?IntermediateYour app needs cert-manager's CRDs, an Issuer and then a Certificate, all in one Application. The first sync fails. What do you do?IntermediateYou want a smoke test to run after every deploy and mark the sync failed if it fails. How?BeginnerAn HPA scales your Deployment, but Argo CD with self-heal keeps resetting replicas to 2. What do you do?BeginnerYou must change a Deployment's label selector, which is immutable. How do you roll it out with Argo CD?AdvancedA team wants Argo CD to deploy only during business hours, except for emergencies. How do you set it up?Beginner