Skip to content

How to fix an ArgoCD application stuck in deletion

Updated: at 08:12 AM

Running into issues with ArgoCD can be pretty frustrating, especially when you’re trying to delete an application that just won’t go away. I recently encountered a situation where the repository was deleted before the application itself, causing the app deletion to get stuck.

To save time for myself and help out other sys admins who might face the same problem, I wanted to share a straightforward solution.

Step 1: Delete the Application Namespace

First things first, remove the namespace associated with the problematic application. This ensures that the app is no longer active, as sometimes ArgoCD doesn’t fully delete the application on its own.

Step 2: Remove the Finalizer

Assuming your ArgoCD namespace is argocd and you have the APP_NAME of the stuck application, you can clear the finalizer using the following kubectl command:

kubectl patch application/APP_NAME --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' -n argocd

This command effectively removes the finalizer, allowing Kubernetes to fully delete the application without any hiccups.

And that’s it! Once again, kubectl, saving the day one command line at a time.