Minikube on Windows 10 with Hyper-V
Getting started with Kubernetes can be daunting when you don’t know where to begin. Luckily the folks at Kubernetes have a great platform you can run locally on your laptop. This will setup up a basic test bed for kubernetes called Minikube. I will quickly walk you through getting up and running with minikube.
Pre-reqs before getting started
- Windows package manager, Chocolatey. (Go here for a guide to install chocolatey)
- Hyper-V installed on your Windows 10 machine. (Use this guide to get Hyper-V installed)
Open a command line window with administrator privileges.
Then use the chocolatey package manager to install minikube.
choco install minikube
Next install the kubernetes command line program with the chocolatey package manager.
choco install kubernetes-cli
Once that is installed you will need to make some changes to the Windows Hyper-V manager. I will not get into the reasons why we need to make some of these changes, but the short answer is so you don’t have to do more work to run this along side other software packages like Docker-For-Windows that also use Windows Hyper-V, seamlessly.
Open the Hyper-V Manager.
Once in the Hyper-V Manager, on the right panel, select the Virtual Switch Manager.
Next we will create a virtual switch for minikube. Select New virtual network switch on the right hand side, select External for the network type, and then press the Create Virtual Switch button.
Name the switch Primary Virtual Switch and click the apply button.
Once you have the switch created we are now ready to start minikube. Run the following command to start the minikube VM with our applied changes.
minikube start --vm-driver hyperv --hyperv-virtual-switch "Primary Virtual Switch"
Once the VM is running we will have two more steps to do to address a bug in minikube for Windows. We need to turn off Dynamic Memory for the minikube VM. There is bug reported on this issue which can be found here. Once this bug has been resolved, I will update the instructions here.
In your administrator command line window stop the minikube VM with the following command.
Once minikube has stopped, open the Hyper-V Manager again and right click on the minikube VM and select settings.
Select the Memory option on the left panel, then de-select Enable Dynamic Memory, and then click Apply button.
Close Hyper-V manager and then return to the administrator command line window and restart minikube.
Once minikube is restarted you should be ready to go. We will confirm the installation is ready by checking a couple of things.
In the command line window, enter the following command.
kubectl get pods -n kube-system
You should see the following result.
If you are a little more visual and want to see the kubernetes dashboard, you can open that up by typing in the following command in the command line window.
That will open up the dashboard window in your default browser.
Now you are ready to explore and start your journey to learning Kubernetes.
Side Note on IPv6 Networking and Minikube on Windows 10
- I got some feedback that some users were experiencing a problem with IPv6 networking. There are some cases where minikube will not work with the network switch we created earlier in this guide. To correct this you will need to disable IPv6 protocol if this is the case. The IPv6 issue is reported on GitHub.
- The following guide will help you quickly disable IPv6: https://medium.com/@JockDaRock/disabling-ipv6-on-network-adapter-windows-10-5fad010bca75
If you would like to take your Kubernetes experience to the next level, try reserving a free sandbox lab environment for Kubernetes from Cisco DevNet Sandbox. Use the following guides to get started with Kubernetes in DevNet Sandbox.