Minikube on Windows

When I’m playing with Kubernetes, I usually get a cluster from Google Kubernetes Engine (GKE) because it’s literally a single gcloud command to get a Kubernetes cluster up and running on GKE.  It is sometimes useful though to have a Kubernetes cluster running locally for testing and debugging. Minikube is perfect for this.

logo

Minikube runs a single-node Kubernetes cluster inside a VM on your laptop. There are instructions on how to install it on Linux, Mac and Windows. Unfortunately, instructions for Windows is a little lacking, so I want to document how I got Minikube up and running on my Windows 10 machine.

First, you need to download the minikube-windows-amd64.exe file, rename it to minikube.exe and add it to your path, as explained in the instructions for Windows. Instructions make it sound like you’re done at this point but if you try to start minikube in PowerShell admin mode, you will get an error like this:

carbon

This is because Minikube needs a VM and by default, it tries to use VirtualBox. On Windows, you can either use Hyper-V (available natively on Windows 10) or you can install VirtualBox. Many people (here and here) recommend VirtualBox to avoid issues but I didn’t want to install something extra like VirtualBox, so I decided to go with Hyper-V. You can tell Minikube via –vm-driver=hyperv flag to use Hyper-V but this also failed with the same error earlier.

carbon (1)

What’s happening? Turns out, there’s a bug on Minikube and Windows 10. This GitHub issue explains the details if you’re interested and this very useful comment explains what you need to do. You basically need to create a Virtual Switch in Hyper-V and allow your actual internet connection share its connection with this Virtual Switch.

After you create the Virtual Switch, you can start minikube with Hyper-V with additional –hyperv-virtual-switch flag. It’s a good idea to also delete .minikube folder under your home folder and don’t forget to start PowerShell in admin mode.

carbon

This takes a while for the first time as it needs to download ISO images etc. but once done, you can test the local cluster by creating a deployment and deploying an echoserver pod:

carbon (1)

That’s it! Hope this was useful for you to get Minikube up and running on Windows.

Advertisements

One thought on “Minikube on Windows

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s