Completely stop/delete Rancher

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).

All this is on Docker for Mac using Rancher 2.0.2.

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.

@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,