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.
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:
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.
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.
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:
That’s it! Hope this was useful for you to get Minikube up and running on Windows.
Originally published at meteatamel.wordpress.com on February 14, 2018.