> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/resilience-testing/chaos-testing/experiments/clean-up-experiment-resources.md).

# Clean Up Experiment Resources

Remove the pods, configmaps, and secrets a chaos experiment run left behind in your cluster, from the run's timeline view.

{% hint style="info" %}
This feature is in Beta[^1] and requires enablement. [View all early access features.](https://developer.harness.io/release-notes/features.md)

{% @harness-feature-flag-access/request-feature-flag-access module="resilience-testing" pagePath="resilience-testing/chaos-testing/experiments/clean-up-experiment-resources" pageTitle="Clean%20up%20experiment%20resources" featureFlags="%5B%7B%22name%22%3A%22Experiment%20resource%20cleanup%22%2C%22key%22%3A%22CHAOS\_RESOURCE\_CLEANUP\_ENABLED%22%2C%22status%22%3A%22BETA%22%2C%22description%22%3A%22Adds%20a%20Cleanup%20action%20to%20a%20chaos%20experiment%20run%2C%20which%20deletes%20the%20resources%20that%20run%20created%20in%20the%20target%20cluster.%22%7D%5D" %}
{% endhint %}

When a chaos experiment run errors or stops partway, it can leave pods, configmaps, and secrets in the target cluster. **Cleanup** removes what that run left behind, so you do not have to find and delete the resources by hand.

***

## Before you begin <a href="#before-you-begin" id="before-you-begin"></a>

* **A Kubernetes experiment run:** A run on a [Kubernetes (Harness Infrastructure)](https://developer.harness.io/resilience-testing/chaos-testing/infrastructure/kubernetes.md) chaos infrastructure.
* **A current Harness Delegate:** The delegate that serves the infrastructure must support the cleanup task. Go to [Install Delegate](https://developer.harness.io/harness-platform/use-harness-platform/delegates/delegate/install-delegates/overview) to upgrade it.

***

## Clean up a run <a href="#clean-up-a-run" id="clean-up-a-run"></a>

Perform the following steps:

1. Go to **Chaos Experiments**, then select the **Executions** tab.
2. Click the **More** icon on the run, then select **View Execution**.
3. Click **Cleanup** in the action bar on the right edge of the timeline view.
4. Click **Cleanup** at the top of the panel that opens.

![The Cleanup panel for a run, with the Cleanup button at the top and a summary row of Status, Namespace, Resources found, Resources deleted, Failed deletions, and Last cleanup, all showing N/A before the first cleanup](https://3217710372-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRmV5EkLS9r45VPaoUnJZ%2Fuploads%2Fgit-blob-3a22849c1e90d058c8791615d2660d050439b7bb%2Fexperiment-cleanup-panel.png?alt=media)

The summary row and the **Logs** tab report the result of the most recent cleanup. If a cleanup fails, the panel shows the reason and the button changes to **Force Cleanup**.

***

## Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

<details>

<summary>Do network rules stay in place after a fault ends?</summary>

When a run errors or stops partway, it can leave Kubernetes resources in the target cluster. **Cleanup** deletes only the resources that run created: Deployments, Pods, Services, ConfigMaps, Secrets, Jobs, and CronJobs. It does not change node-level network rules. If network rules such as `tc` or iptables rules stay on a node after a fault ends, contact Harness Support. Cleanup is behind the feature flag `CHAOS_RESOURCE_CLEANUP_ENABLED`.

</details>

<details>

<summary>Cleanup failed: CHAOS_CLEANUP_TASK_NG task type not supported by delegate</summary>

The delegate that serves the infrastructure is older than the cleanup task, so nothing was deleted. Upgrade the delegate, then run the cleanup again.

</details>

[^1]: Off by default. If you want to try it and share feedback, request access and Harness will turn it on for your account. Beta features can change and may not be ready for production use.
