Minikube setup on MacOS

Install Minikube on MacOS

Most of the stuff in this post is described in the official documentation, which is also what I used for this. What I wanted to add is the graphics and opportunity for people to see what it looks like. Commands are listed in italic.

You can find the official guide from Kubernetes here.

https://kubernetes.io/docs/tasks/tools/install-minikube/

Steps to do before you start is to make sure you have a Hypervisor installed. This, for mac can be HyperKit, VirtualBox or VMware Fusion. I will use Fusion in my case.

First run this command:

sysctl -a | grep -E --color 'machdep.cpu.features|VMX'

This gives you an output if you have the right CPU type:

01 - Status-Check.png

If you see colored output, here highlighting VMX then you are OK.

Next is a section of commands that I collected to run.

mkdir latest && sudo mkdir -p /usr/local/bin
cd minikube
curl -LO $(curl -s $r/releases/latest | grep -o 'http.*darwin_amd64' | head -n1)
sudo install docker-machine-driver-vmware_darwin_amd64 /usr/local/bin/docker-machine-driver-vmware
sudo ls -al /usr/bin/local

01a - Install Docker Machine Drivers.png

Output should be like below (I forgot this step and hence minikube and Kubectl are already present).

02 - Status-Check-dck-mch-drv.png

Installing Kubectl

Run the below

Download Kubectl. Run the following command:

curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl" && \
sudo mv kubectl /usr/local/bin/kubectl && kubectl version --client

03 - Download-Kubectl.png

Installing MiniKube

Again we need to do a download:

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64 \
  && chmod +x minikube
mv minikube /usr/local/bin/

After the download and the permission change the file is moved the /usr/local/bin along with kubectl by doing a ls command: ls -al /usr/local/bin/

04 - Download Minikube.png

To confirm the installation you can perform the following steps:

Run the following command: minikube start –vm-driver=<driver_name> Where driver_name is the driver you have installed. You can see a list of what drivers you should use here. Since I have VMware Fusion installed it is VMware as shown in the command  below:

minikube start --vm-driver=vmware

Now some things should start to happen on the screen:

05 - Minikube First Start.png

Thanks to Apples vigilance you will most likely get a prompt like this next: 

06 - Apple Privacy Warning

Opening the Preferences takes you to where you need to change it. You may need to click on the Padlock at the bottom of the screen to get access to the tick box.

You will get one more warning when you click the tick box. Click the “Later” and let things continue.

07 - Privacy Setting Edited

After that back in the terminal the steps continues automatically.

At the end you should have something like this:

08 - Cont First Start

You can set the MiniKube default vm-driver to vmware like this (This will require a restart of MiniKube if it is running):

minikube config set vm-driver vmware

If you need to troubleshoot the startup then you can run the following command when starting minikube, to monitor for crashes and debug them.

minikube start –alsologtostderr -v=7

To test that all is running you can check the status of minikube by doing the following command:

minikube status

This should give you an output like this:

09 - Minikube status

Stopping minikube is simple, just issue the following command: minikube stop

10 - Minikube stop

you can start it again by replacing stop with start: minikube start

If minikube for some reason does not start or returns an error you can remove the local state by issuing the following command:

minikube delete

That is pretty much it for the installation and verification of Minikube installation.

Leave a Reply