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.
Join the DZone community and get the full member experience.
Join For FreeKubernetes 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?
You may also enjoy Linode's Beginner's Guide to Kubernetes.
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:
- Download the kubectl.exe using a link and save the file in any folder on windows file system.
- 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.
- Open a command prompt and type kubectl and you should see all commands supported by kubectl.
Install minikube
VT-x or AMD-v virtualization must be enabled in your computer’s BIOS.
Install the virtualization platform such as Virtualbox or KVM. You are not really required to configure the image.
Download the minikube-windows-amd64 file from here.
The current version of minikube is v0.29.0.
Rename the file to minikube.exe. Note the extension “exe” is added.
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.
Open the command prompt and fire a command minikube and you should see all the commands supported by minikube.
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
.
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.
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.
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:
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.
That’s it! Now you can start playing with the K8s cluster installed locally on Windows.
Opinions expressed by DZone contributors are their own.
Comments