Feedback

Chat Icon

GitOps the Hard Way, with Argo CD

Build Real GitOps Pipelines From Empty Clusters to Automated Deploys

Sync Policy: Every Field, Every Sync Option, Every Annotation
49%

What Happens to Resources When You Delete an Application

We examined how pruning works when a resource is removed from Git, but what happens when you delete the whole Application? First, let's distinguish between deleting an Application and pruning resources:

  • Pruning happens during a sync. A resource drops out of Git, the diff marks it for removal, and prune: true deletes it while the Application keeps running.
  • Deleting an Application is a different event: you remove the Application object itself, and the question becomes what happens to every resource it was managing.

Whether the managed resources are deleted with the Application is decided by the resources-finalizer.argocd.argoproj.io finalizer on the Application.

  • With the finalizer set, deleting the Application cascade-deletes everything it manages first, then removes the Application.
  • Without it, only the Application object is deleted and the managed resources keep running, now owned by nothing.
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: $APP_NAME
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io  # delete managed resources with the app

That is the theory, but in practice, how you delete the Application can add that finalizer for you. In other words, there is no need, in general, to add the finalizer manually.

The CLI:

Using the CLI, deleting the Application is as simple as:

argocd app delete $APP_NAME

GitOps the Hard Way, with Argo CD

Build Real GitOps Pipelines From Empty Clusters to Automated Deploys

Enroll now to unlock all content and receive all future updates for free.