Kubernetes on Windows: how to set up


on 19 June 2019

MicroK8s is a solution for teams wanting to deploy Kubernetes on Windows for developing and testing purposes. Below we include steps for quick set up on Windows.


MicroK8s, a Linux snap, is Ubuntu’s lightweight, CNCF-certified local distribution of Kubernetes that installs in 30 seconds or less.  It runs all Kubernetes services natively on Ubuntu, or any operating system (OS) that supports snaps, and deploys a single cluster on a local PC. This gives teams flexibility to test microservices on a small scale, develop and train machine learning models locally, or embed upgradeable Kubernetes in IoT devices for easy evolution.

While MicroK8s automates the typical functions of Kubernetes locally, such as scheduling, scaling and debugging, it also adds another layer of reliability because it provides the latest Kubernetes for development. The latest upstream version of Kubernetes is always available on Ubuntu within one week of official release.

Kubernetes on Windows works by setting up a Kubernetes cluster in an Ubuntu VM.

With this is mind, MicroK8s and Kubernetes both need a Linux kernel to operate and require an Ubuntu VM, which can be created using Multipass. Multipass is the tool that instantly launches and manages Ubuntu VMs on Windows, MacOS and Linux.  The VM provides another layer of security,  isolating the Kubernetes instance from the outside world.

Kubernetes on Windows set up steps 

What follows here are the steps to set up Multipass, interact with MicroK8s on the VM and how to add-on DNS to view the MicroK8s dashboard.

Note that there are a few requirements for running Multipass on Windows 10 Enterprise or Pro with hyper-v enabled on a trusted network as discussed here.

Step 1: Set up a VM for Windows using Multipass

To start a VM with MicroK8s run: 

multipass launch --name microk8s-vm --mem 4G --disk 40G

multipass exec microk8s-vm -- sudo snap install microk8s --classic

multipass exec microk8s-vm -- sudo iptables -P FORWARD ACCEPT

Ensure sufficient resources are available to host these deployments. Below we’ve created a VM named microk8s-vm and given it 4GB of RAM and 40GB of disk.

Our VM has an IP that can  be checked with the following: (Take note of this IP since our services will become available here).

multipass list

Name           State IPv4            Release

microk8s-vm    RUNNING    Ubuntu 18.04 LTS

Step 2: Interact with MicroK8s on the VM

There are three ways to interact with Multipass in a VM.

  • Using a Multipass shell prompt (command line) by running:
multipass shell microk8s-vm
  • Using multipass exec to execute a command without a shell prompt by inputting:
multipass exec microk8s-vm -- /snap/bin/microk8s.status
  • Using the Kubernetes API server running in the VM.. Here one would use MicroK8s kubeconfig file with a local installation of kubectl to access the in-VM-kubernetes. Do this by running:
multipass exec microk8s-vm -- /snap/bin/microk8s.config > kubeconfig

Next install kubectl on the host machine and then use the kubeconfig:

kubectl --kubeconfig=kubeconfig get all --all-namespaces
default  service/kubernetes   ClusterIP   <none> 443/TCP 3m12s

Step 3: Access in-VM Multipass services - enabling MicroK8s add-ons

A basic MicroK8s add-on to set up is the Grafana dashboard. Below we show one way of accessing Grafana to monitor and analyse a MicroK8s instance. To do this execute:

multipass exec microk8s-vm -- /snap/bin/microk8s.enable dns dashboard
Enabling DNS
Applying manifest
service/kube-dns created
serviceaccount/kube-dns created
configmap/kube-dns created
deployment.extensions/kube-dns created
Restarting kubelet
DNS is enabled
Enabling dashboard
secret/kubernetes-dashboard-certs created
serviceaccount/kubernetes-dashboard created
deployment.apps/kubernetes-dashboard created
service/kubernetes-dashboard created
service/monitoring-grafana created
service/monitoring-influxdb created
service/heapster created
deployment.extensions/monitoring-influxdb-grafana-v4 created
serviceaccount/heapster created
configmap/heapster-config created
configmap/eventer-config created
deployment.extensions/heapster-v1.5.2 created
dashboard enabled

Next, check the deployment progress by running:

multipass exec microk8s-vm -- /snap/bin/microk8s.kubectl get all --all-namespaces

Which should return output similar to:

Once all services are running, access the dashboard. The image below shows the Grafana of our dashboard.

Kubernetes on Windows summary

MicroK8s gives teams the opportunity to test out their work before going public, automating the standard tasks of Kubernetes, while adding an extra layer of reliability.

Useful reading:

Ubuntu cloud

Ubuntu offers all the training, software infrastructure, tools, services and support you need for your public and private clouds.

Newsletter signup

Select topics you’re
interested in

In submitting this form, I confirm that I have read and agree to Canonical’s Privacy Notice and Privacy Policy.

Related posts

MicroK8s now native on Windows and macOS

Windows and macOS developers can now use MicroK8s natively! Use kubectl at the Windows or Mac command line to interact with MicroK8s locally just as you would...

Kubernetes for Data Science: meet Kubeflow

Deep Learning is set to thrive Data science has exploded as a practice in the past decade and has become an undisputed driver of innovation. The forcing...

Kubernetes on Windows with MicroK8s and WSL 2

Kubernetes has enjoyed an unparalleled 5-year growth that has revolutionised the IT industry. It has become a key factor for organisations to be successful...