Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Setting Up Kubernetes (K8s) on Windows

DZone's Guide to

Setting Up Kubernetes (K8s) on Windows

Learn what components you need to download and install to run a local copy of Kubernetes on your Windows machine with a Cygwin terminal.

· Cloud Zone ·
Free Resource

Discover a centralized approach to monitor your virtual infrastructure, on-premise IT environment, and cloud infrastructure – all on a single platform.

Kubernetes is container orchestration engine. Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.

How do you setup local Kubernetes on a Windows machine?

Install kubectl

kubectl is a Kubernetes command-line tool, and it is used to deploy and manage applications on Kubernetes. kubectl provides features to inspect cluster resources, create, delete, and update components, get the status of K8s clusters, and deploy and run applications in K8s.

Here are the steps to set up a kubectl on Windows:

  1. Download the kubectl.exe using a link and save the file in any folder on windows file system.
  2. Add the kubectl.exe folder location in path variable - “Advanced System Settings -> Advanced -> Environment Variables -> Path”. For example, if you have saved file to C:/kube then add this folder path to the path variable.
  3. Open a command prompt and type kubectl and you should see all commands supported by kubectl.Image title

Install minikube

  1. VT-x or AMD-v virtualization must be enabled in your computer’s BIOS.

  2. Install the virtualization platform such as Virtualbox or KVM. You are not really required to configure the image.

  3. Download the minikube-windows-amd64 file from here.

  4.   The current version of minikube is v0.29.0.Image title

  5. Rename the file to minikube.exe. Note the extension “exe” is added.

  6. Add this folder path location in path variable: “Advanced System Settings -> Advanced -> Environment Variables -> Path.” For example, if you have saved the file to C:/kube then add this folder path to the path variable.

  7. Open the command prompt and fire a command minikube and you should see all the commands supported by minikube.Image title

Install Cygwin

The Windows command prompt really sucks when it comes to using K8s. The Linux terminal provides a fantastic user experience while running Docker commands or K8s commands. On windows, you can get similar kind of user experience with Cygwin. Install Cygwin by following the steps listed on its website.

Start MiniKube

Now, its time to start the K8s local cluster. Open the Cygwin terminal and run command $ minikube start .

Image title


At this stage, what we are hoping for a successful start-up of K8s cluster. The terminal should not hang or freeze. The first time, it will take some time to start the cluster while in the background, K8s downloads the kubelet, kubeadm, and minikube iso files, amounting to around 150 MB. Depending upon your network speed, after a few seconds/minutes you should see the following output on terminal.

Image title


Check the Client of K8s

Run command kubectl version   to confirm the working of minikube. You should get details of client version and server version.

Image title


What Is Really Happening?

Even though we really did not set up any images in VirtualBox, how are things working? Is the K8s cluster is running on the host OS, Windows? Not exactly, if you just open VirtualBox then you will see something like this:

Image title


It clearly shows that minikube is running inside VirtualBox.

Check K8s Master

Execute kubectl cluster-info to check details of K8s master. If you have any other daemon deployed in K8s then details of those processes will also be highlighted.

Image title

That’s it! Now you can start playing with the K8s cluster installed locally on Windows.

Learn how to auto-discover your containers and monitor their performance, capture Docker host and container metrics to allocate host resources, and provision containers.

Topics:
kubernates ,minikube ,automation ,cloud ,installation ,cygwin

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}