Skip to content

Instantly share code, notes, and snippets.

@itsmikita
Last active December 17, 2023 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsmikita/6f0da55372ff50fd321862943d45e594 to your computer and use it in GitHub Desktop.
Save itsmikita/6f0da55372ff50fd321862943d45e594 to your computer and use it in GitHub Desktop.
How to uninstall Kubernetes (microk8s, minikube, podman, docker, kubernetes-cli) from macOS

How to uninstall Kubernetes (microk8s, minikube, podman, docker, kubernetes-cli) from macOS

I've been trying out all different kinds of containerization and it's a good to have one reminder for myself how to reset the system. So here it goes:

Remove microk8s

The ubuntu guys did it nice and implemented the uninstall sub-command. To uninstall microk8s from your system run:

microk8s uninstall

If you installed microk8s with Homebrew, then uninstall it:

brew rm microk8s

If your added alias for kubectl in your shell profile remove it manually from your ~/.zshrc:

alias kubectl="microk8s kubectl"

Remove multipass

Run the embedded shell script:

sudo sh /Library/Application\ Support/com.canonical.multipass/uninstall.sh

Or remove its VMs and itself manually:

multipass delete -vv --purge --all
sudo rm -rfv /Library/LaunchDaemons/com.canonical.multipassd.plist
sudo rm -rfv /Library/Application\ Support/com.canonical.multipass
sudo rm -rfv /Applications/Multipass.app
sudo rm -rfv /var/root/Library/Application\ Support/multipassd
sudo rm -rfv /var/root/Library/Application\ Support/multipass-client-certificate
sudo rm -rfv /var/root/Library/Preferences/multipassd
sudo rm -rfv /Library/Logs/Multipass
rm -fv /usr/local/bin/multipass
rm -fv /usr/local/bin/multipass.gui
rm -rfv /usr/local/etc/bash_completion.d/multipass
rm -rfv /usr/local/share/bash-completion/completions/multipass

Remove minikube

Uninstall it with Homebrew:

brew rm minikube

Or do it manually:

minikube stop
minikube delete
launchctl stop "*kubelet*.mount"
launchctl stop localkube.service
launchctl disable localkube.service
rm -rfv /usr/local/bin/localkube
rm -rfv /usr/local/bin/minikube
rm -rfv ~/.minikube

If your added alias for kubectl in your shell profile remove it manually from your ~/.zshrc:

alias kubectl="minikube kubectl"

Remove podman

podman machine stop podman-machine-default
podman machine rm podman-machine-default
brew rm podman

Remove docker

Use the uninstall script or remove it manually:

sudo docker prune -af --volumes
sudo docker-machine rm -f $(docker-machine ls -q)
sudo rm -rfv /Applications/Docker.app
rm -fv /usr/local/bin/docker
rm -fv /usr/local/bin/docker-machine
rm -rfv /usr/local/bin/docker-machine-driver*
rm -fv /usr/local/bin/docker-compose
rm -rfv /usr/local/share/boot2docker

Remove kubernetes-cli

If you do not know where the binary lives, run:

which kubectl

And then remove the path:

rm -rfv /.rd/bin/kubectl
kubeadm reset
sudo rm -rfv /etc/kubernetes
rm -rfv ~/.kube
brew rm -f kubernetes-cli

Resources:

https://github.com/docker-archive/toolbox/blob/master/osx/uninstall.sh
https://stackoverflow.com/a/73603526/3524606
canonical/multipass#620 (comment)
https://github.com/docker-archive/toolbox/blob/master/osx/uninstall.sh
https://gist.github.com/rahulkumar-aws/65e6fbe16cc71012cef997957a1530a3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment