# KOTS: How do I reset or clean up an install?

**URL:** <https://community.replicated.com/t/kots-how-do-i-reset-or-clean-up-an-install/579>\
**Category:** Supporting your customers\
**Tags:** kots\
**Created:** [September 27, 2021, 3:39pm UTC](https://community.replicated.com/t/kots-how-do-i-reset-or-clean-up-an-install/579 "2021-09-27T15:39:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AJ-Jester](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/aj-jester/32/94_2.png) [@AJ-Jester](https://community.replicated.com/u/AJ-Jester)\
**Post date:** [September 27, 2021, 3:39pm UTC](https://community.replicated.com/t/kots-how-do-i-reset-or-clean-up-an-install/579/1 "2021-09-27T15:39:17Z")

</div>

I have kots adm and the app installed, how do I clean up these components?

---

<div class="post-metadata">

**Author:** ![AJ-Jester](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/aj-jester/32/94_2.png) [@AJ-Jester](https://community.replicated.com/u/AJ-Jester)\
**Post date:** [September 27, 2021, 3:49pm UTC](https://community.replicated.com/t/kots-how-do-i-reset-or-clean-up-an-install/579/2 "2021-09-27T15:49:46Z")

</div>

## Remove App

If you want to just clean up the app, say for instance you used an incorrect license, you can use the [kots remove](https://kots.io/kots-cli/remove/) command. But please note, this will only remove the reference to the app in kots adm db, but the K8s resources of the app need to be cleaned up manually.

`kubectl kots remove <app-slug> -n <namespace>`

If you would like to clean up kots and the app in its entirety, that depends on the type of environment you have running. A best practice here is to add a specific `app=myapp` label to all your workloads and k8s objects, so you can clean everything with a single command:

```auto
kubectl delete all --selector app=myapp

```

Note that `all` [does not delete _every_ resource](https://stackoverflow.com/a/60585130/10055299), for example if you also want to clean up secrets, configmaps, roles, etc, you could use something like

```auto
kubectl delete all,secret,configmap --selector app=myapp

```

## Remove Kotsadm

### Embedded

- first thing you can try is [resetting the node](https://kurl.sh/docs/install-with-kurl/adding-nodes#resetting-a-node) using the `tasks.sh` reset script.

- If that does not work, rebuild the VM with a fresh OS and start install from scratch.

### Existing

- Delete the namespace where kotsadm is installed, presumably that is the same namespace where the app is installed as well: `kubectl delete ns <namespace>`

**Note** : This will not clean up resources managed outside the namespace such as CRDs.

---

<div class="post-metadata">

**Author:** ![zvikir](https://avatars.discourse-cdn.com/v4/letter/z/91b2a8/32.png) [@zvikir](https://community.replicated.com/u/zvikir)\
**Post date:** [December 19, 2022, 10:50am UTC](https://community.replicated.com/t/kots-how-do-i-reset-or-clean-up-an-install/579/3 "2022-12-19T10:50:17Z")

</div>

Hello  
Is there no way to completely remove everything that was installed with the kurl installer without re-provision the machine?

---

<div class="post-metadata">

**Author:** ![salahalsaleh](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/salahalsaleh/32/464_2.png) [@salahalsaleh](https://community.replicated.com/u/salahalsaleh)\
**Post date:** [December 19, 2022, 6:04pm UTC](https://community.replicated.com/t/kots-how-do-i-reset-or-clean-up-an-install/579/4 "2022-12-19T18:04:01Z")

</div>

Hi @zvikir, please refer to the following documentation on how to remove the admin console and reset a kURL cluster: [Deleting the Admin Console and Removing Applications | Replicated Docs](https://docs.replicated.com/enterprise/delete-admin-console#delete-from-a-kubernetes-installer-cluster)

To clarify, the reset script will remove everything that was installed by the kURL installer, and not just the admin console.

---

<div class="post-metadata">

**Author:** ![jdewinne](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/jdewinne/32/152_2.png) [@jdewinne](https://community.replicated.com/u/jdewinne)\
**Post date:** [January 25, 2023, 6:11pm UTC](https://community.replicated.com/t/kots-how-do-i-reset-or-clean-up-an-install/579/5 "2023-01-25T18:11:58Z")

</div>

I’ve created a small script that uses the `kots download` and `kots upload` mechanism to fully remove an application from kotsadm, including the deployed resources. The script assumes that all the `kots` manifest files start with `kots-` and the application manifest files (including Helm charts) are not nested in subfolders. If that is different , you’ll have to change the `find . -maxdepth 1 -type f -name "*" ! -name "kots*"` part in the script.

```auto
#!/bin/bash
set -e
APP_SLUG=$1
KOTS_NAMESPACE=$2
if [[-z "$APP_SLUG"]]; then
   # $APP_SLUG is empty
   echo First arg should be app slug
   exit 1
fi
if [[-z "$KOTS_NAMESPACE"]]; then
   # $KOTS_NAMESPACE is empty
   echo Second arg should be kots namespace
   exit 1
fi
echo Removing app $APP_SLUG from namespace $KOTS_NAMESPACE
rm -rf $APP_SLUG
kubectl kots download --namespace $KOTS_NAMESPACE --slug $APP_SLUG
(cd $APP_SLUG/upstream; rm $(find . -maxdepth 1 -type f -name "*" ! -name "kots*"); )
kubectl kots upload --namespace $KOTS_NAMESPACE --slug $APP_SLUG --deploy --skip-preflights ./$APP_SLUG
kubectl kots remove $APP_SLUG --namespace $KOTS_NAMESPACE --force

```
