How to Install Kubernetes on Windows 10 with Hyper-v using Minikube| Learn Kubernetes – Part 6

We are all set with the theoretical concepts of Kubernetes. Now we are going to take you through setting up Minikube on your Windows 10 Pro machine with Hyper-V. This will setup up a basic platform for Kubernetes called Minikube. This is one of the Installation Model we discussed in last article of “Getting Start with Kubernetes.” This method is basically known as Local Machine Solution(Minikube).

We will quickly walk you through with the basic prerequisites to set your belt for the installation and setup.

Windows 10 Pro Physical machine(Laptop) and ensure to keep Memory at least 8 GB for a good performance. Keeping 4 GB Memory won’t allow you to power on Minikube VM.

Prerequisites: –

  • VT-x/AMD-v virtualization must be enabled in BIOS.
  • Enable Hyper-v on your Windows 10 Machine.
  • Download the latest Minikube. Click Here.
  • Download the latest Kubectl command line utility. Click Here.
  • Windows Package Manager – Chocolatey
  • And most important thing that you must have Internet connectivity on Windows 10 machine.

Installation Steps: –

  1. Download all required components.
  2. Place Minikube and Kubectl in C drive.
  3. Install Hyper-v in Windows 10 machine
  4. Configure Hyper-v Networking
  5. Install Chocolatey in Windows 10 machine
  6. Setup Minikube VM using Minikube command line.
  7. Verify Kubernetes Dashboard

Step by Step Guide: –

Follow the Prerequisites: –

  • Download the latest Minikube. Click Here.
  • Download the latest Kubectl command line utility. Click Here.
  • The file name is minikube-windows-amd64.exe. Rename this exe as “minikube”.
  • Place minikube and kubectl in C drive root directory. You need to place these files in OS drive because there is a bug in the Minikube which does not allow to install the local cluster if it is place anywhere other than C drive or in OS drive.
  • Go to Run and type %HOMEPATH%.minikube. Verify the folder. You will see folders inside .minikube.

Install Hyper-v in Windows 10 Machine: –

  • Start your windows 10 machine in BIOS and verify that Intel VT-x/AMD-v virtualization is enabled. You can click here to see how to enable this feature.
  • Login to Windows 10 Machine. Go to Run and type appwiz.cpl
  • Click on Turn on Windows Features.
  • Here you will have to select Hyper-v Management Tools and Hyper-V Platform.
  • Click on OK. It will restart the machine.

2018-08-10 02_27_09-Windows Features

  • It is installing the feature.

2018-08-10 02_27_32-Windows Features

  • Hyper-v feature has been successfully installed. Click on Restart Now.

2018-08-10 02_28_22-Windows Features

Install and Setup minikube for Kubernetes environment: –

  • Download the latest Minikube. Click Here.
  • Download the latest Kubectl command line utility. Click Here.
  • The file name is minikube-windows-amd64.exe. Rename this exe as “minikube.exe”.
  • Place minikube and kubectl in C drive root directory. You need to place these files in OS drive because there is a bug in the Minikube which does not allow to install the local cluster if it is place anywhere other than C drive or in OS drive.
  • Open PowerShell using Administrative Privilege.
  • In below screenshots, my root directory is D drive as I am using dual boot in my laptop. If your system drive is C: then use below commands.
cd
c:
  • Below command will display the version of minikube.exe
.minikube.exe
  • Below command will show version of kubernetes. Make sure that you have internet in your machine. Minikube supports multiple versions of Kubernetes, we recommend you to use latest version
.minikube.exe get-k8s-versions

2018-08-10 02_37_20-Administrator_ Windows PowerShell

  • Go to Run and Type %HOMEPATH%.minikube. Press enter.

2018-08-10 02_38_00-Run

  • You will see folder called .minikube and there will be many sub folders inside this folder. This is to validate environmental variables.

2018-08-10 02_38_04-.minikube

Install Windows Package Manager – Chocolatey : –

For further deployments, you need to use Kubernetes Command Line Interface(CLI). To ta install that, you need to have Chocolatey Package manager as you are using windows platform.

  • You can browse URL https://chocolatey.org to see more information on this. Click on Install Chocolatey Now. You will get several options to install this.

2018-08-10 02_40_42-Chocolatey - The package manager for Windows ‎- Microsoft Edge

  • Here we are going to use below command to install Chocolatey Package Manager. Make sure that you have internet in your machine.
@"%SystemRoot%System32WindowsPowerShellv1.0powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%chocolateybin"

2018-08-10 02_42_56-Administrator_ Command Prompt

  • Chocolatey has been successfully installed. Here you can refer to the message.

2018-08-10 02_43_58-Administrator_ Command Prompt

Install Minikube and Kubectl using Chocolatey Package Manager: –

  • Now use the chocolatey package manager to install minikube and kubectl(Kubernetes CLI). It will download and install both components it on your computer. Make sure you have internet.
choco install minikube
choco install kubernetes-cli

2018-08-10 02_44_54-Administrator_ Command Prompt - choco install minikube

  • Type Y to run the script.

2018-08-10 02_46_13-Administrator_ Command Prompt - choco install minikube

  • Chocolatey has installed both packages “minikube” and “kubectl(Kubernetes-CLI)”.

2018-08-10 02_46_26-Administrator_ Command Prompt

Make Networking Configuration in Hyper-V: –

Once you are done with above steps, now next step is to make your Hyper-V networking to use your local machine NICs. So make changes in this following below steps.

  • Go to Search and Type Hyper-V Manager.

2018-08-10 02_49_40-Start

  • On Hyper-V Manager console, Click on Virtual Switch Manager in right panel.
  • Click on Create Virtual Switch using External type.

2018-08-10 02_50_26-Virtual Switch Manager for DESKTOP-L3S8EDR

  • Give name of Virtual Switch and Select your Physical NIC of laptop in External Network so that it can communicate with external Nework.
  • Make sure to mark Check box on “Allow management operating system to share this network adapter” option.
  • Click on OK.

2018-08-10 02_52_14-Virtual Switch Manager for DESKTOP-L3S8EDR

  • Start Minikube VM which is on Hyper-V using below command.
minikube start --vm-driver hyperv --hyperv-virtual-switch "Pathshala Primary Virtual Switch"
  • One thing that I wanted to highlight here about an issue which I faced in my lab, that keep your laptop atleast with 8 GB memory. Because minikube VM get creates by default with 2 GB memory and rest will be used by your physical machine. However it is good to assign 4 GB memory to minikube VM. You can use below command to assign 4 GB memory.
minikube start --vm-driver=hyperv --kubernetes-version="v1.10.0" --hyperv-virtual-switch="Pathshala Primary Virtual Switch" --memory 4096

2018-08-10-02_55_16-Administrator_-Command-Prompt.png

  • Downloading Minikube ISO is in progress. Once complete, it will create a Virtual machine in your Hyper-V console. Keep monitoring your console.

2018-08-10 02_55_20-Administrator_ Command Prompt - minikube start --vm-driver hyperv --hyperv-virt

  • Keep monitoring the status of the task from this console.

2018-08-10 03_02_29-Administrator_ Windows PowerShell2018-08-10 03_02_03-Administrator_ Windows PowerShell

  • Press Y .

2018-08-10 03_02_29-Administrator_ Windows PowerShell

  • Here you can see that virtual machine with name of minikube has been created. As of now it is power off state. Once the above status will get complete, it will automatically power on this VM and will do the rest configuration.

 

2018-08-10 03_14_07-Hyper-V Manager

    • Once Minikube get successfully install, you need to Enable Dynamic Memory option.

 

  • To perform this, stop the Minikube by using below command.

 

 

 

minikube stop
  • Go to Hyper-V Manager, and Right Click on minikube VM. Click Edit Settings and Go to Memory Options.
  • Click on Enable Dynamic Memory and Click on OK.

2018-08-10 03_14_20-Settings for minikube on DESKTOP-L3S8EDR

  • Use below command to start Minikube.
minikube start
  • Check Minikube Status by using below command
minikube status
  • Output will be similar to below.
    • minikube: Running
    • cluster: Running
    • kubectl: Correctly Configured: pointing to minikube-vm at 192.168.66.53
  • So all done from installation and setup part. Now access your Kubernetes Dashboard by using below command.
minikube dashboard

kubernetes dashboard

That’s all from this Module of “Kubernetes Learning”. You can find all related articles here.

What is Kubernetes? | Learn Kubernetes – Part 1

Components and Architecture of Kubernetes | Learn Kubernetes – Part 2

Versions of Kubernetes | Learn Kubernetes – Part 3

Kubernetes Terminology every admins need to know | Learn Kubernetes – Part 4

Getting Start to Setup and Configure Kubernetes | Learn Kubernetes – Part 5

How to Install Kubernetes on Windows 10 with Hyper-v using Minikube| Learn Kubernetes – Part 6

Thank you so much visiting here. If you found anything which needs correction, please do share in comment box.

If you found this article useful, please do share with others.