GitOps & ArgoCD (50 Qs)•Part 3: Enterprise Scale, Security & Edge GitOps (Senior / Staff)
How do you handle Stateful Applications and PVCs in GitOps?
senior LevelCode ExampleSecurity & Auth
In Simple Words:
When an Application containing a PersistentVolumeClaim is pruned, deleting the PVC can cause catastrophic data loss!
Add the retention annotation to sensitive stateful manifests:
yaml
metadata:
annotations:
helm.sh/resource-policy: keep
argocd.argoproj.io/sync-options: Delete=false
This tells ArgoCD to delete pods and services during tear-down, but never delete the underlying persistent disk storage.