How to run Kubernetes on Windows 10


running Kubernetes on Windows 10 for testing is a very desirable possibility and many people want to test it on their local machine and probably not familier with Linux and running windows 10 on their laptops.

in this post we will go through the process of setting Kubernetes on a single node by using Minikube.

“Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a VM on your laptop for users looking to try out Kubernetes or develop with it day-to-day.”

to keep things simple and clean we gonna use Microsoft Hype-V that comes with Windows 10 and Chocolatey for automated installation.

First we need to check weather our local machine is able to run the setup, Hyper-V requires 64-Bit CPU, all the commands will be run as an Administrator in Powershell

Configuring the machine:

  • Enable virtualization on BIOS level (check the photos)
  • Enable Hyper-V in Windows 10, as and Administrator run the command:
PS> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
  • Install Chocolatey, as an Administrator run the command:
PS> Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  • Configure a new external Virtual Switch in Hype-V, start Hyper-V management:

02    02

  • Using Chocolatey install Minikube, as an Administrator run the command:
PS> choco install minikube
  • Start Minikude using Hyper-V Driver with the configured Virtual Switch and see if every thing works
PS> minikube start --vm-driver hyperv --hyperv-virtual-switch "minikube"
  • Start the Kubernetes Dashboard in your browser by running the command:
PS> minikube dashboard

now you can enjoy the setup and test Kubernetes.

if you want to run a test application

Start Nginex web server in a cluster (5 instances)

PS> kubectl run my-nginx --image=nginx --replicas=5 --port=80

Open the port to the public with Load Balancing

PS> kubectl expose deployment my-nginx --target-port=80 --type=LoadBalancer

Check the deployment

PS> kubectl get services

in some cases an external IP is not configured (EXTERNAL-IP <Pending>), use alternative URL instead

PS > minikube service my-nginx --url

 

Hope this post will encourage and help people to start checking out Kubernetes.

Advertisements
This entry was posted in Containers and tagged , , , , . Bookmark the permalink.

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s