# Completely stop/delete Rancher

**URL:** <https://forums.suse.com/t/completely-stop-delete-rancher/10779>\
**Category:** SUSE Rancher Prime\
**Created:** [June 15, 2018, 4:32pm UTC](https://forums.suse.com/t/completely-stop-delete-rancher/10779 "2018-06-15T16:32:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![afgane](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/afgane/32/3796_2.png) [@afgane](https://forums.suse.com/u/afgane)\
**Post date:** [June 15, 2018, 4:32pm UTC](https://forums.suse.com/t/completely-stop-delete-rancher/10779/1 "2018-06-15T16:32:40Z")

</div>

For demo purposes, we’d like to be able to setup Rancher2 on a laptop and while the process generally works, it appears state is kept somewhere after all the containers and volume are removed. How do I completely clear state from an earlier Rancher setup?

For example, I launched an instance yesterday and then deleted all the containers using `docker rm -f $(docker ps -aq)` as well as volumes using `docker volume prune -f` (this required Docker restart as several volumes lingered after initially running the command). After starting up Rancher, I run `kubectl get ns` and the age of returned namespaces is 19hrs even though this particular deployment has been up for about 10 minutes. Some other artifacts indicate at state being kept (eg, getting the same error as reported here [https://github.com/rancher/rancher/issues/13734](https://github.com/rancher/rancher/issues/13734)).

All this is on Docker for Mac using Rancher 2.0.2.

---

<div class="post-metadata">

**Author:** ![sra](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/sra/32/1514_2.png) [@sra](https://forums.suse.com/u/sra)\
**Post date:** [June 16, 2018, 10:42am UTC](https://forums.suse.com/t/completely-stop-delete-rancher/10779/2 "2018-06-16T10:42:08Z")

</div>

If you don’t have anything else important in that D4M kubernetes env, just use reset kubernetes from the D4M preferences. Otherwise, deleting the `cattle-system` namespace should do everything except a bunch of annotations on stuff.

EDIT: I was wrong - a bunch of custom resource definitions are left, along with some troublesome finalizers on other objects like namespaces which cause them to hang when being deleted. A more comprehensive cleanup is needed to expunge it.

---

<div class="post-metadata">

**Author:** ![amioranza](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/amioranza/32/3053_2.png) [@amioranza](https://forums.suse.com/u/amioranza)\
**Post date:** [July 4, 2018, 2:16pm UTC](https://forums.suse.com/t/completely-stop-delete-rancher/10779/3 "2018-07-04T14:16:42Z")

</div>

@afgane,

When you import a new cluster to Rancher you receive a kubectl apply command with a parameter that is a complete deployment and ohter stuff needed to create the cattle-system, serviceaccount, and other stuf on your cluster. One thing you can try is use the oposite command kubectl delete -f with the same paramenters to validate if it did the complete cleanup of Rancher of your Kubernetes.

Att,
