github.com/argoproj/argo-cd/v3@v3.2.1/docs/user-guide/app_deletion.md (about)

     1  # App Deletion
     2  
     3  Apps can be deleted with or without a cascade option. A **cascade delete**, deletes both the app and its resources, rather than only the app.
     4  
     5  ## Deletion Using `argocd`
     6  
     7  To perform a non-cascade delete:
     8  
     9  ```bash
    10  argocd app delete APPNAME --cascade=false
    11  ```
    12  
    13  To perform a cascade delete:
    14  
    15  ```bash
    16  argocd app delete APPNAME --cascade
    17  ```
    18  
    19  or
    20  
    21  ```bash
    22  argocd app delete APPNAME
    23  ```
    24  
    25  ## Deletion Using `kubectl`
    26  
    27  To perform a non-cascade delete, make sure the finalizer is unset and then delete the app:
    28  
    29  ```bash
    30  kubectl patch app APPNAME  -p '{"metadata": {"finalizers": null}}' --type merge
    31  kubectl delete app APPNAME
    32  ```
    33  
    34  To perform a cascade delete set the finalizer, e.g. using `kubectl patch`:
    35  
    36  ```bash
    37  kubectl patch app APPNAME  -p '{"metadata": {"finalizers": ["resources-finalizer.argocd.argoproj.io"]}}' --type merge
    38  kubectl delete app APPNAME
    39  ```
    40  
    41  ## About The Deletion Finalizer
    42  
    43  ```yaml
    44  metadata:
    45    finalizers:
    46      # The default behaviour is foreground cascading deletion
    47      - resources-finalizer.argocd.argoproj.io
    48      # Alternatively, you can use background cascading deletion
    49      # - resources-finalizer.argocd.argoproj.io/background
    50  ```
    51  
    52  When deleting an Application with this finalizer, the Argo CD application controller will perform a cascading delete of the Application's resources.
    53  
    54  Adding the finalizer enables cascading deletes when implementing [the App of Apps pattern](../operator-manual/cluster-bootstrapping.md#cascading-deletion).
    55  
    56  The default propagation policy for cascading deletion is [foreground cascading deletion](https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion).
    57  Argo CD performs [background cascading deletion](https://kubernetes.io/docs/concepts/architecture/garbage-collection/#background-deletion) when `resources-finalizer.argocd.argoproj.io/background` is set.
    58  
    59  When you invoke `argocd app delete` with `--cascade`, the finalizer is added automatically.
    60  You can set the propagation policy with `--propagation-policy <foreground|background>`.
    61  
    62  ## Deleting Applications in the UI
    63  
    64  Argo CD provides a consistent deletion experience across different views in the UI. When deleting applications, you can access the delete functionality from:
    65  
    66  - **Applications List View**: The main applications page showing all applications
    67  - **Application Details View - Resource Tree**: When viewing an application's resource tree that contains child applications
    68  
    69  ### Consistent Deletion Behaviour
    70  
    71  Starting in Argo CD 3.2, deletion behavior is now **consistent** across all UI views. Whether you delete an application from the Applications List or from the Resource Tree view, the same deletion mechanism and options are used.
    72  
    73  Previously, deleting an application from the Resource Tree treated it as a generic Kubernetes resource, which could lead to unexpected behaviour with non-cascading deletes. Now, Argo CD properly detects Application resources and uses the standard Application deletion API in all contexts.
    74  
    75  ### Deleting Child Applications in App of Apps Pattern
    76  
    77  When using the [App of Apps pattern](../operator-manual/cluster-bootstrapping.md), parent applications can contain child applications as resources. Argo CD automatically detects child applications and provides improved dialog messages to help you understand what you're deleting.
    78  
    79  #### Child Application Detection
    80  
    81  Argo CD identifies a child application by checking for the `app.kubernetes.io/part-of` label. If this label is present and has a non-empty value, the application is considered a child application.
    82  
    83  #### Delete Dialog Differences
    84  
    85  **When deleting a child application:**
    86  
    87  - Dialog title: "Delete child application"
    88  - Confirmation prompt references "child application" to make it clear you're deleting a managed application
    89  - Additional warning note appears when deleting from the Resource Tree
    90  
    91  **When deleting a regular application:**
    92  
    93  - Dialog title: "Delete application"
    94  - Standard confirmation prompt
    95  
    96  **When deleting from the Resource Tree:**
    97  
    98  An additional informational note appears:
    99  
   100  > ⚠️ **Note:** You are about to delete an Application from the resource tree. This uses the same deletion behaviour as the Applications list page.
   101  
   102  This note clarifies that the deletion will use the proper Application deletion API, not generic Kubernetes resource deletion.
   103  
   104  ### Deletion Options (Propagation Policies)
   105  
   106  When deleting an application through the UI, you can choose from three propagation policies:
   107  
   108  #### 1. Foreground (Default)
   109  
   110  - Deletes the application and all its managed resources
   111  - Waits for all managed resources to be deleted before the Application is removed
   112  - **Use case**: When you want to ensure all resources are cleaned up before the Application disappears
   113  
   114  #### 2. Background
   115  
   116  - Deletes the application and all its managed resources
   117  - The Application is removed immediately, and resources are deleted in the background
   118  - **Use case**: When you want faster Application deletion and don't need to wait for resource cleanup
   119  
   120  #### 3. Non-Cascading (Orphan)
   121  
   122  - Deletes **only** the Application resource
   123  - All managed resources (Deployments, Services, ConfigMaps, etc.) are **preserved** in the cluster
   124  - The finalizer is removed automatically before deletion
   125  - **Use case**: When you want to stop managing resources through Argo CD but keep them running
   126  
   127  > [!WARNING]
   128  > **Important for Non-Cascading Deletes**
   129  >
   130  > When you select **Non-Cascading**, Argo CD will:
   131  > - Remove the `resources-finalizer.argocd.argoproj.io` finalizer from the Application
   132  > - Delete only the Application resource
   133  > - Leave all managed resources (Pods, Services, Deployments, etc.) running in the cluster
   134  >
   135  > This behaviour is now **consistent** whether you delete from the Applications List or from the Resource Tree view.
   136  
   137  ### Best Practices for App of Apps Pattern
   138  
   139  When working with the App of Apps pattern:
   140  
   141  1. **Understand the impact**: Deleting a child application with Foreground or Background propagation will delete all of its managed resources
   142  2. **Review before deleting**: Always verify what resources are managed by the application before performing a cascading delete
   143  3. **Use Non-Cascading cautiously**: If you only want to remove the Application resource but keep the deployed workloads, use Non-Cascading delete
   144  4. **Consider finalizers**: Ensure child applications have appropriate finalizers set based on your deletion strategy (see [Cascading Deletion](../operator-manual/cluster-bootstrapping.md#cascading-deletion))
   145  
   146  ### Example Scenarios
   147  
   148  #### Scenario 1: Deleting a child application and all its resources
   149  
   150  1. Navigate to the parent application's Resource Tree
   151  2. Click the kebab menu (button with the three vertical dots) on a child Application resource
   152  3. Select "Delete"
   153  4. Choose **Foreground** or **Background** propagation policy
   154  5. Confirm the deletion
   155  
   156  **Result**: The child Application and all its managed resources (Deployments, Services, etc.) are deleted.
   157  
   158  #### Scenario 2: Removing Argo CD management but keeping resources
   159  
   160  1. Navigate to the Applications List or the parent application's Resource Tree
   161  2. Click the kebab menu (button with the three vertical dots) on a child Application resource
   162  3. Select "Delete"
   163  4. Choose **Non-Cascading** propagation policy
   164  5. Confirm the deletion
   165  
   166  **Result**: Only the Application resource is deleted. All managed resources continue running in the cluster.
   167  
   168  #### Scenario 3: Deleting from Resource Tree with context awareness
   169  
   170  When you delete a child application from the Resource Tree view:
   171  
   172  - Argo CD recognizes it as an Application resource (not just a generic Kubernetes resource)
   173  - Shows "Delete child application" dialog if it detects the `app.kubernetes.io/part-of` label
   174  - Displays an informational note explaining you're using the same behaviour as the Applications List
   175  - Provides the same three propagation policy options
   176  
   177  This ensures predictable and consistent deletion behaviour regardless of where you initiate the deletion.