Minikube: How to uninstall?

Created on 26 Jan 2017  路  27Comments  路  Source: kubernetes/minikube

It got docker to be brocken on macos.
While I run it it was ok, but after deleting all pods and sopped it I wasn't able to use docker ps.

Docker: 1.13

kinsupport

Most helpful comment

:bomb:

To completely nuke it, this worked for me on Linux:

minikube stop; minikube delete
docker stop (docker ps -aq)
rm -r ~/.kube ~/.minikube
sudo rm /usr/local/bin/localkube /usr/local/bin/minikube
systemctl stop '*kubelet*.mount'
sudo rm -rf /etc/kubernetes/
docker system prune -af --volumes

Note that this also nukes all your current docker data.

All 27 comments

Can you try running:

eval $(minikube docker-env -u)

doesn't work :(

It actually doesn't remove minikube.
But after that docker started to work :)

Yeah sorry, the steps to fully remove minikube depend on how you installed it and your platform. That command just resets environment variables so your other Docker installation continues to work.

How did you install minikube, and what platform are you on?

Closing for now. Let us know if you have any more problems.

Also trying to uninstall minikube... not successful. Any start of kubectl get a context of local minikube. How to get rid of this... easy to use... monster?

Kubectl has it's own config file for managing the context. You can use kubectl config use-context to change to something else.

I've installed minikube and kubectl on ubuntu, both using the curl method. I've removed Kubernetes by running 'sudo rm /usr/local/bin/kubectl'. I was wondering how can I fully remove these. Instances of localkube are running and the multiple k8s... docker images are still running.

I have the same issue, I just finished the minikube tutorial and now I am completely unable to stop and remove these containers, they always get recreated:

CONTAINER ID        IMAGE                                                  COMMAND                  CREATED             STATUS              PORTS               NAMES
7523fd2c20c7        gcr.io/google_containers/k8s-dns-sidecar-amd64         "/sidecar --v=2 --..."   18 hours ago        Up 18 hours                             k8s_sidecar_kube-dns-86f6f55dd5-qwc6z_kube-system_c1333ffc-e4d6-11e7-bccf-0021ccbf0996_0
9bd438011406        gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64   "/dnsmasq-nanny -v..."   18 hours ago        Up 18 hours                             k8s_dnsmasq_kube-dns-86f6f55dd5-qwc6z_kube-system_c1333ffc-e4d6-11e7-bccf-0021ccbf0996_0
5c35e00a5a27        gcr.io/google_containers/k8s-dns-kube-dns-amd64        "/kube-dns --domai..."   18 hours ago        Up 18 hours                             k8s_kubedns_kube-dns-86f6f55dd5-qwc6z_kube-system_c1333ffc-e4d6-11e7-bccf-0021ccbf0996_0
77ef463642b7        gcr.io/google_containers/pause-amd64:3.0               "/pause"                 18 hours ago        Up 18 hours                             k8s_POD_kube-dns-86f6f55dd5-qwc6z_kube-system_c1333ffc-e4d6-11e7-bccf-0021ccbf0996_0
39f618666205        gcr.io/google_containers/kubernetes-dashboard-amd64    "/dashboard --inse..."   18 hours ago        Up 18 hours                             k8s_kubernetes-dashboard_kubernetes-dashboard-vgpjl_kube-system_c1176a44-e4d6-11e7-bccf-0021ccbf0996_0
023b7b554a8c        gcr.io/google_containers/pause-amd64:3.0               "/pause"                 18 hours ago        Up 18 hours                             k8s_POD_kubernetes-dashboard-vgpjl_kube-system_c1176a44-e4d6-11e7-bccf-0021ccbf0996_0
1c3bdb7bdeb1        gcr.io/google-containers/kube-addon-manager            "/opt/kube-addons.sh"    18 hours ago        Up 18 hours                             k8s_kube-addon-manager_kube-addon-manager-tpad_kube-system_7b19c3ba446df5355649563d32723e4f_0
8a00feefa754        gcr.io/google_containers/pause-amd64:3.0               "/pause"                 18 hours ago        Up 18 hours                             k8s_POD_kube-addon-manager-tpad_kube-system_7b19c3ba446df5355649563d32723e4f_0
b657eab5f6f5        gcr.io/k8s-minikube/storage-provisioner                "/storage-provisioner"   18 hours ago        Up 18 hours                             k8s_storage-provisioner_storage-provisioner_kube-system_c0a8b187-e4d6-11e7-bccf-0021ccbf0996_0
67be5cc1dd0d        gcr.io/google_containers/pause-amd64:3.0               "/pause"                 18 hours ago        Up 18 hours                             k8s_POD_storage-provisioner_kube-system_c0a8b187-e4d6-11e7-bccf-0021ccbf0996_0

I also created an issue on stackoverflow, trying to get help to remove these containers.

https://stackoverflow.com/questions/47891870/cannot-stop-10-containers-after-kubernetes-minikube-tutorial

@nimamox were you able to stop and remove the containers?

:bomb:

To completely nuke it, this worked for me on Linux:

minikube stop; minikube delete
docker stop (docker ps -aq)
rm -r ~/.kube ~/.minikube
sudo rm /usr/local/bin/localkube /usr/local/bin/minikube
systemctl stop '*kubelet*.mount'
sudo rm -rf /etc/kubernetes/
docker system prune -af --volumes

Note that this also nukes all your current docker data.

Minor suggested edit, I think line 2 should be docker stop $(docker ps -aq)

@djcomlab good one, does it not work on bash otherwise?

I'm using the Fish shell so $() doesn't work.

@Siilwyn Ah I see! Yeah, bash needs $ to return the stdout from the subshell command.

@Siilwyn Thanks for the steps. I would at least stop and disable the localkube.service as well.

systemctl stop localkube.service
systemctl disable localkube.service

How to delete services: https://superuser.com/questions/513159/how-to-remove-systemd-services (did not do it).
I am not sure about '*kubelet*.mount', I did not have it installed (checked in 'sudo systemctl list-unit-files --type=service').

@attila123
It should be systemctl, not systemclt.

@chenliangomc good catch, thanks. Corrected it.

@attila123 would the following preserve other non-k8s docker containers?

docker stop $(docker ps | grep k8s | cut -d\  -f1)

Is there any plan to make a real uninstaller?..

Hopefully, this is all of it but converted to macOS tools

minikube stop; minikube delete &&
docker stop $(docker ps -aq) &&
rm -rf ~/.kube ~/.minikube &&
sudo rm -rf /usr/local/bin/localkube /usr/local/bin/minikube &&
launchctl stop '*kubelet*.mount' &&
launchctl stop localkube.service &&
launchctl disable localkube.service &&
sudo rm -rf /etc/kubernetes/ &&
docker system prune -af --volumes
systemctl stop kubelet  
systemctl disable kubelet

Is what ultimately worked for me to stop containers from returning, from stackoverflow question, thank you @viktorsmari

FWIW I followed @scott-joe's instructions from Apr 18 and was successful except for:

$ launchctl disable localkube.service
Unrecognized target specifier. <service-target> takes a form of <domain-target>/<service-id>.
Please refer to `man launchctl` for explanation of the <domain-target> specifiers.
Usage: launchctl disable <service-target>

AFAICT there's no localkube.service or anything similarly named. Also, @majgis comment above refers to systemctl which doesn't exist, though "launchctl stop kubelet" did work, and I understand it's the equivalent.

@richard-reece Experienced the same with failing command. However, I don't think launchctl stop kubelet works - it returns exit code 3 for me:

$ launchctl stop kubelet; echo $?
3

Thank you @majgis for bringing this up!!!

systemctl stop kubelet  
systemctl disable kubelet

Is what ultimately worked for me to stop containers from returning, from stackoverflow question, thank you @viktorsmari

Thanks a lot for pointing this out. It stopped these minikube containers from coming up.
You made my day!

brew cask uninstall minikube
brew cask install minikube
__________________other troubleshooting
minikube delete : to delete a corrupted k8s cluster
minikube start : create a new k8's cluster

FWIW, I didn't find the docker stop $(...) bit to be necessary - minikube stop already killed all the k8s containers

@Siilwyn Thank you sooooooooo much!!! after 30 min. googling that little thing you helped me more than the kubernetes docs!

So, this could be a summary to DELETE and bust the minikube out of Ubuntu 18.04LTS, type

sudo minikube stop
sudo minikube delete
sudo docker stop $(docker ps -aq)
sudo rm -r ~/.kube ~/.minikube
sudo rm /usr/local/bin/localkube /usr/local/bin/minikube
systemctl stop 'kubelet.mount'
sudo rm -rf /etc/kubernetes/
docker system prune -af --volumes

Note- the last command line above, also nukes all your current docker data!

To stop containers from returning back, type:

systemctl stop kubelet

systemctl disable kubelet

To check either kubelet.service is running, type:

sudo systemctl list-unit-files --type=service

if its enabled then type:

systemctl stop localkube.service

systemctl disable localkube.service

Was this page helpful?
0 / 5 - 0 ratings