Installation of Minikube on MacOS

Minikube has emerged the easiest drop-in replacement for Docker Desktop. minikube is used to run a Kubernetes cluster on local environment. But it also runs a docker daemon that can be used to run containers. On macOS, minikube runs on a lot of virtualization technologies, but hyperkit is the easiest to use.

Install Hyperkit and Minikube

brew install hyperkit
brew install minikube

Install Docker CLI

brew install docker
brew install docker-compose

Start minikube

minikube start

Tell Docker CLI to talk to minikube’s VM

eval $(minikube docker-env)

Save IP to a Hostname

echo "`minikube ip` docker.local" | sudo tee -a /etc/hosts > /dev/null

Test

docker run hello-world

Minikube Cheatsheet

  • minikube stop - stop the VM and k8s cluster. This does not delete any data. Just run minikube start to spin up the cluster.

  • minikube delete - This deletes the cluster with all the data. All mapped volumes will be lost. Know what you’re doing before running this. If you just want to stop the cluster use minikube stop.

  • minikube ip - IP address of the VM where the cluster and docker engine run.

Minikube runs a k8s setup and thus runs a lot of containers that are not required if not using k8s. We can run ‘minikube pause’ to pause k8s related containers so they do not end up consuming system resources.