Course contentsShow
← Cloud and Infrastructure
Lesson 1905 of 2,98940. ArgoCDFree lesson

Application Deletion and Finalizers

Understanding cascading deletes, finalizers, and safe application removal.

Application Deletion and Finalizers

What you'll learn: How ArgoCD safely removes applications and cleans up their Kubernetes resources using cascading deletes and finalizers.

The Core Concept

When you delete an ArgoCD Application, you're not just removing a configuration object—you're potentially tearing down dozens or hundreds of Kubernetes resources (Deployments, Services, ConfigMaps, etc.). ArgoCD uses finalizers to ensure this cleanup happens properly before the Application itself disappears.

Think of a finalizer like a "pre-deletion checklist." Before Kubernetes allows an Application to be truly deleted, ArgoCD's finalizer ensures all managed resources are removed first—preventing orphaned resources from cluttering your cluster.

How Cascading Deletion Works

By default, ArgoCD Applications have a finalizer called resources-finalizer.argocd.argoproj.io. When you delete an Application:

  1. Kubernetes marks it for deletion but doesn't remove it yet
  2. ArgoCD's controller sees the finalizer and begins deleting all tracked resources
  3. Only after all child resources are gone does ArgoCD remove its finalizer
  4. Kubernetes completes the Application deletion

This is called cascading deletion—the parent takes its children with it.

Non-Cascading Deletion

Sometimes you want to remove the Application without deleting resources (perhaps handing control to another tool). You can disable the finalizer:

metadata:
  finalizers: []  # Empty means no cascade

Or use the CLI flag --cascade=false when deleting.

Safety First

Finalizers protect against accidental resource leakage. Without them, deleting an Application would leave all your pods, services, and volumes running—disconnected and unmanaged.

Key Takeaway: ArgoCD finalizers ensure safe application deletion through cascading deletes, removing all managed Kubernetes resources before the Application itself is removed—preventing orphaned infrastructure.