Minikube in Windows machine


As a windows user sometimes we feel helpless when trying to use community products. Kubernetes is great but it’s local test environment “minikube” is not so great. Occasionally it is very annoying especially for window user. Here I like to share my experience and quick solution that I have learned. Like my other post, this writing is not for expert but will save valuable hours of beginners like me. 

 

Why we need minikube

Minikube is local development environment for kubernetes. Except some advance features like  “Load Balancing” it is possible to test kubernetes in local pc.

 

 What is kubectl 

Kubectl is a kubernetes command tools that will connect kubernetes cluster(minikube), deploy app and manage cluster resources.

 

Install kubectl(windows)

  • Find the latest version number from below

       https://storage.googleapis.com/kubernetes-release/release/stable.txt

  • Download latest exe from below url, replace {version number} with actual version number,

      https://storage.googleapis.com/kubernetes-release/release/{version number}/bin/windows/amd64/kubectl.exe

     Example for version v1.15.1 :

     https://storage.googleapis.com/kubernetes-release/release/v1.15.1/bin/windows/amd64/kubectl.exe

  • (Optional) Create a folder in the C drive and move the exe to that folder.

     For more details: https://kubernetes.io/docs/tasks/tools/install-kubectl

 

Install minikube(windows)

  1. Make sure you have install hyper-v. 
  2. Make sure Docker is running.
  3. Download minikube-installer.exe from. Always download the latest version.

https://github.com/kubernetes/minikube/releases

  1. Add install folder at windows env path variable
  2. Add hyper-v network switch. You can skip this step if you run cluster in default switch.

https://medium.com/@JockDaRock/minikube-on-windows-10-with-hyper-v-6ef0f4dc158c

Check current active ethernet information using Powershell command Get-NetAdapter to configure switch.

  1. Execute below command in PowerShell admin mode. 
 
minikube start --vm-driver hyperv --hyperv-virtual-switch "Minikube Virtual Switch"

 

For default switch you can remove virtual switch parameter.

 
minikube start --vm-driver hyperv

 

For details log of minikube activity, add below log parameter,

 
minikube start --vm-driver hyperv --alsologtostderr

Any issue?

If you are not super lucky, it is a high chance that you will get error during minikube start. So stay cool, read the error message carefully. Below I have listed some checked list to overcome errors,

 

  • If minikube hyperv images has been created, unchecked dynamic memory in Hyper-v image from window Hyper-v manager.
  • Make sure docker is running. Also make sure you are using Powershell in admin mode.
  • Always use latest version minikube and kubectl tools. 
  • If system waiting for SSH access show long time, delete cluster, delete private switch and create again. Or you can change to default switch from VM, then initiate minikube start command again.

Cluster delete command,

 
minikube delete -p minikube
minikube start --vm-driver hyperv

Worked before but not today !!

It’s very common issue i have seen. Most of the times minikube getting problem when i try to start minikube after starting my laptop. Below is my todo list, 

 

  • Make sure docker is running. Also make sure you are using Powershell in admin mode.
  • Restart hyper-v minikube images from hyper-v manager, then execute minikube start command again. 
 
minikube start
  • Delete minikube cluster( hyper-v image) and start minikube again.
 
minikube delete -p minikube

Importance links:

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

https://medium.com/@JockDaRock/minikube-on-windows-10-with-hyper-v-6ef0f4dc158c

https://medium.com/@mudrii/kubernetes-local-development-with-minikube-on-hyper-v-windows-10-75f52ad1ed42

https://kubernetes.io/docs/reference/kubectl/cheatsheet

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 )

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