Listen to this Post

Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes, widely used for managing and automating deployments. A common challenge users face is properly deleting Argo CD applications without leaving residual resources. This article clarifies the difference between prune and resource deletion and provides actionable steps to manage Argo CD applications effectively.
You Should Know:
1. Prune vs. Resource Deletion
- Prune: Removes resources no longer defined in Git but retains the application in Argo CD.
- Resource Deletion: Fully deletes both the application and its managed resources.
2. Deleting an Argo CD Application Properly
Use the following command to delete an Argo CD application and its resources:
argocd app delete <APPLICATION_NAME> --cascade
If you only want to remove the app but keep resources:
argocd app delete <APPLICATION_NAME>
3. Manual Cleanup (If Needed)
If resources remain, delete them manually via `kubectl`:
kubectl delete -n <NAMESPACE> <RESOURCE_TYPE> <RESOURCE_NAME>
4. Force Deletion (Stuck Resources)
For terminating namespaces or stuck resources, force deletion:
kubectl patch namespace <NAMESPACE> -p '{"metadata":{"finalizers":[]}}' --type=merge
5. Automating Cleanup with Policies
Configure `syncPolicy` in `Application` manifests to auto-prune:
syncPolicy: automated: prune: true selfHeal: true
What Undercode Say
Misconfigurations in Argo CD deletions can lead to orphaned resources or unintended data loss. Always verify:
– Sync Status: `argocd app get
– Resource List: `kubectl get all -n
– Audit Logs: `argocd app logs
For advanced users, integrate Argo CD with CI/CD pipelines to enforce deletion policies. Example Jenkins step:
sh 'argocd app delete ${APP_NAME} --cascade --yes'
Expected Output:
application '<APPLICATION_NAME>' deleted
Prediction
As GitOps adoption grows, expect tighter integration between Argo CD and Kubernetes RBAC to prevent accidental deletions, alongside more robust pruning safeguards.
Relevant URL:
References:
Reported By: Csantanapr Understanding – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅


