Skip to content

Instantly share code, notes, and snippets.

@rahulkumar-aws
Last active March 22, 2024 14:57
Show Gist options
  • Star 28 You must be signed in to star a gist
  • Fork 15 You must be signed in to fork a gist
  • Save rahulkumar-aws/65e6fbe16cc71012cef997957a1530a3 to your computer and use it in GitHub Desktop.
Save rahulkumar-aws/65e6fbe16cc71012cef997957a1530a3 to your computer and use it in GitHub Desktop.
Install/Uninstall Minikube from Mac
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

Final

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

Install Minikube

$ brew install docker-machine-driver-xhyve

# docker-machine-driver-xhyve need root owner and uid
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64 && \
chmod +x minikube && \
sudo mv minikube /usr/local/bin/
curl -LO https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-hyperkit \
&& chmod +x docker-machine-driver-hyperkit \
&& sudo mv docker-machine-driver-hyperkit /usr/local/bin/ \
&& sudo chown root:wheel /usr/local/bin/docker-machine-driver-hyperkit \
&& sudo chmod u+s /usr/local/bin/docker-machine-driver-hyperkit
minikube start --logtostderr --v=3 --vm-driver=hyperkit
minikube version
minikube ssh
$ docker version
kubectl config get-contexts

deploy a simple image

kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.4 --port=8080

expose the service outside the cluster

kubectl expose deployment hello-minikube --type=NodePort
minikube service hello-minikube --url

Dashboard

minikube dashboard
@CyberSecDalvi
Copy link

For Mac users - If you get an error after this command,
minikube start --logtostderr --v=3 --vm-driver=hyperkit

Exiting due to PROVIDER_HYPERKIT_NOT_FOUND: The 'hyperkit' provider was not found: exec: "hyperkit": executable file not found in $PATH W0925 22:43:24.527625 4798 out.go:242] 💡 Suggestion: Run 'brew install hyperkit' 💡 Suggestion: Run 'brew install hyperkit'

just run another brew install of hyperkit

@Rustam-Z
Copy link

https://kubernetes.io/docs/tutorials/hello-minikube/ To create the deployment and expose it, you can follow the documentation

@cyrus-za
Copy link

Is therea a M1 chip equivalent of this? We can't run hyperkit on M1 and that curl downloads the amd64 version of minikube

@TheSithPadawan
Copy link

I get the below error while executing: brew install docker-machine-driver-xhyve
Error: docker-machine-driver-xhyve has been disabled because it does not build!

Mac Version is Monterey, does anyone have the same issue?

@moodhacker
Copy link

moodhacker commented Jan 16, 2023

I get the below error while executing: brew install docker-machine-driver-xhyve Error: docker-machine-driver-xhyve has been disabled because it does not build!

Mac Version is Monterey, does anyone have the same issue?

I have the same issue- Try 'brew install hyperkit'

@dgroh
Copy link

dgroh commented Jul 28, 2023

You forgot to mention this gonna mess up with the Kubernetes installation coming with docker desktop.

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