Understanding preserveResourcesOnDeletion and Its Behavior in Argo CD
When decommissioning an ApplicationSet
, you might want to preserve the underlying Kubernetes resources created by the Applications it generated.
Argo CD provides the preserveResourcesOnDeletion
flag for this purpose.
Key Configuration
To ensure managed resources are not deleted when the ApplicationSet
is removed, set this in your ApplicationSet
:
spec:
syncPolicy:
preserveResourcesOnDeletion: true
ApplicationSet
is deleted.Important Notes
-
✅ Kubernetes resources will be preserved
-
❌ Argo CD Applications will be removed (unless otherwise handled)
-
🚫 No need to set
PrunePropagationPolicy=orphan
-
This is used only during Application syncs, not AppSet deletion.
-
-
⚠️ Sync event is not triggered on AppSet deletion, so no additional sync logic applies.
Preserving Argo CD Applications
If you also want to retain the Argo CD Application
resources, follow this guide:
📘 How to prevent deleting generated Applications
In short:
-
Set
applicationsSync: create-update
in.spec.syncPolicy
of theApplicationSet
-
Add the finalizer manually to each generated Application:
metadata:
finalizers:
- resources-finalizer.argocd.argoproj.io
You’re safe to delete the ApplicationSet
if:
-
preserveResourcesOnDeletion: true
is set ✅ -
You don’t need the Argo CD
Application
resources afterward
If you need to keep both the Applications and their managed resources, apply both the syncPolicy and finalizers as documented.