Setting Up Minikube With Windows 10
In order to run Kubernets & Docker locally, if you’re running on Windows 10 & you don’t have the pro edition, then you can simply purchase a key to upgrade here. I think it’s reasonable to assume that most people can spare a few pennies here, at the time of writing, the key only costs ~£2.50.
For this tutorial, I’ll be using Chocolatey, because I’m lazy & it’s so quick & easy to use, why not?
If at the time of reading this, things have changed so much that this solution no longer works, you can follow the well written documentation for Minikube here.
First you’ll want to ensure that you have the necessary software installed in order to get the ball rolling, this should go without needing to be said really. But there are two things that you’ll want to ensure you have installed for Kubernetes alone, those are minikube & the Kubernetes-cli packages.
If you want to do some work with Docker also, you can install docker too, but for the sake of argument, let’s just assume you want to get your minikube cluster up & running asap & you’ll bother with Docker later.
Before you run these Chocolatey commands, make sure you’re running cli in administrator mode. If you’re not running in administrator mode, there’s a very strong chance that you’ll get some failures of some degree or antother. Without rambling on, here are the commands that you’ll want to enter.
choco install minikube
choco install kubernetes-cli
Provided you followed the instructions on the screen & everything worked, we can proceed to the next step.
In this tutorial; I’m making the assumption that you know what a hyper visor is, if not then you can read more about what a hyper visor is here. I’m not nerd enough to claim to be an expert on the subject, not by any stretch of the imagination. A small part of the reason why I like to ensure that I have my minikube cluster on its dedicated hypervisor is to increase the separation from other processes running on my machine.
To do so, it’s quite simple really, first you’ll want to open the Hyper-V Manager that comes with Windows 10 Pro edition.
Once you’ve got this application up & running, next you’ll want to open the virtual switch manager, which can be found on the right panel of the screen.
I’ve already setup my virtual switch, as you’ll see in a second, but once you click on the virtual switch manager option, you should see the screen below.
As you can see on the screen above, you have the option Create Virtual Switch, you’ll just wanna click on that button in order to progress further. Personally, in the following screen, I left nearly everything as default, apart from the name, as you may have guessed from the screen above, where you can see that I’ve gone with the name “Minikube Switch”.
As you can see above, this is how you create a virtual switch, once you’re happy, you can then just click apply, followed by ok.
Creating The VM
Now that you’ve got all that nonsense out of the way, you can now build your local Kubernetes cluster. In doing so, it’s super easy; all you have to do is open your cli as admin again & enter the following command:
minikube start --vm-driver hyperv --hyperv-virtual-switch "NAME OF YOUR VIRTUAL SWITCH"
Obviously you’ll need to enter the name of the virtual switch that you’ve just created, provided you’ve done that, you should see the following output. Be warned, depending on your machine, this could take some time, provided you have a relatively modern machine, it really shouldn’t take any noticeable time at all.
Now that your minikube VM is up & running, you can open another cli window & test it out by running the following command:
kubectl get pods -n kube-system
Which should result in the following output:
Now that your able to get minikube up & running, you can progress to the configuration side of things. Personally, I like to ensure that it has enough memory for whatever it is that I’m doing, so to do this, you’ll need to first stop the vm, just simply enter the following into your cli:
Provided that worked, you should have some output like the following image:
Now that you’ve successfully stopped your VM, I’d suggest you go back to the Hyper-V Manager to tinker with some settings. Specifically speaking, I like to give minikube more system memory, to do this you just need to go to Hyper-V Manager & right click on the minikube vm like so:
Provided you’ve done that, you should see the following screen pop up:
I like to ensure that the vm has plenty of memory, so all you have to do here is go down to the memory option on the left & left click it. Once you’ve done that, you should see the following screen.
Now that you’re here, all I suggest you do is enabling the dynamic memory & restarting the vm. In order to restart the vm, all you need to do is enter the following command into the cli:
Once you’ve done that, you should see something like the following appear in your CLI:
Now that you’ve managed to restart your vm, if you’d like more proof that everything is up & running smoothly, you can enter the following command:
You should see some output in your CLI like this:
Now if everything has worked correctly, you should have a tab open in the default browser, pointing to the stated address. Just for verification, you should see something like this:
As you’ve seen in this little tutorial, it’s not too hard to get minikube up & running in Windows 10 Pro, if you try to get this to work with Windows 10 Home edition, it’s likely you will face difficulties. Personally I wasn’t able to get it to work with Windows 10 Home, but at the same time, I’m not what you’d consider an infrastructure nerd or expert.
I hope that you found this little walk-through simple & straightforward, I’m aware that it may not be this simple & straightforward for some, such when working with devices that have been locked down to the extent where you’re unable to setup or configure any virtual machines. Not to mention that based on my own research, you can run into trouble with IPv6 networking, I’ve not done enough research on this subject to state a simple & clear solution, but it’s something to think about.
Anyway, I hope that you’ve enjoyed & had little to no problems with setting minikube up on your Windows 10 device. Finally, I wish you all the best on your experience(s) with K8s! 🙂