Install a complete, single node cluster of Kubernetes on Windows 10
Philippe Beraud
Chief Technology and Security Advisor, Responsible AI Lead at Microsoft | Innovation and Trust
This article will (shortly) introduce popular options that exist to create, as the title indicates, a complete, single node cluster of Kubernetes (K8s) on Windows 10, and then will provide a walk-through for all the steps required to set up and run such a cluster based on these options.
As such, this article can be seen as a continuation of what was introduced with a former article to deliver an improved Linux experience on Windows 10 for developers and beyond.
As shortly described on its web site, Kubernetes (K8s), is an open-source system for automating deployment, scaling, and management of containerized applications.
Gartner predicts that:
By 2022, more than 75% of global organizations will be running containerized applications in production.
In such a context, this Cloud Native Computing Foundation (CNCF) graduated project undoubtedly represents these days a more than hot topic.
Over the last few years, Kubernetes indeed imposed itself as the leading container orchestration environment shaping the future app development and management:
- Kubernetes is widely used. It benefits from a huge adoption with diverse customers and is in production for global companies across industries.
- Kubernetes is vendor neutral. Such a success has driven the more than noticeable growth of (fully managed) Kubernetes services on public clouds. A variety of cloud providers offers robust Kubernetes support, Azure Kubernetes Service (AKS), a certified Kubernetes conformant, being one example on Azure as Microsoft is concerned, and elsewhere on the devices on the edge, for example with Azure Stack Hub, as well as on the organizations’ on-premises infrastructure.
- Kubernetes is community-supported. There’s a huge community of active contributors supporting Kubernetes. Kubernetes collects wisdom, code, and efforts from hundreds of corporate contributors and thousands of individual contributors: 90,000 commits, 2,500 contributors, and #1 GitHub project.
Kubernetes is taking the app development world by storm. So, it could be a great time to learn Kubernetes if you haven’t done so yet. Unsurprisingly, a bunch of Kubernetes training courses are available online. One should outline here solutions like Katacoda for interactive browser-based labs, courses and playgrounds that provides a place to learn and experiment (see Learn Kubernetes, Kubernetes Fundamentals, Kubernetes introduction, etc.). For a suggested Kubernetes learning from Microsoft, see here.
Moreover, within such a vibrant community, people are constantly looking for ways to make Kubernetes easier for organizations to adopt and easier for developers to use. Microsoft is part of this vibrant community and leads in the associated committees to help shape the future of Kubernetes and its ecosystem. As an example, Microsoft, now the third-leading corporate contributor, has recently announced two new open source projects to improve developer and user experiences on top of Kubernetes:
- The Open Application Model (OAM) project under the Open Web Foundation. OMA is a specification that allows developers to define the resources their applications need to run on Kubernetes clusters and which Microsoft developed in cooperation with Alibaba Cloud. As a an reference implementation of OAM, Rudr provides application level primitives for Kubernetes. See blog post Announcing the Open Application Model (OAM), an open standard for developing and operating applications on Kubernetes and other platforms. For a primer, please check out my article Deploying an OAM application to Rudr on top of Kubernetes.
- The Dapr project. Dapr is an event-driven, portable runtime that takes some of the complexity out of building microservices, makes it easy for developers to build resilient, microservice stateless and stateful applications that run on the cloud and edge and embraces the diversity of languages and developer frameworks. See blog post Announcing Distributed Application Runtime (Dapr), an open source project to make it easier for every developer to build microservice applications. For a primer, please check out my article Learn on your Windows 10 development environment all about Distributed Application Runtime (Dapr).
Considering the above, this could be also great to easily and on your terms ramp-up on such capabilities, and consequently do some practices and testing where courses do not necessary (yet) exist. Same consideration applies to local development, etc.
Learning Kubernetes, as well as any related project, and beyond that doing some local development, etc. thus lead to the question on how easy is it to locally create and run a Kubernetes cluster your local machine.
As different Kubernetes solutions exists to meet different requirements, some are hopefully available from both the community and the ecosystem to set up a local learning environment.
Interestingly enough, while Kubernetes runs on Linux, various options also exist on Windows 10. Let’s consider them.
Options to create a Kubernetes cluster locally on Windows 10
Amongst the possibilities, there a huge probability that you might consider the following three options:
- MicroK8s, a Linux only solution developed by the Kubernetes team at Canonical for a lightweight local single node Kubernetes (k8s) cluster.
- Minikube, a virtual machine (VM) based tool that also runs a single node Kubernetes cluster. The result is a local Kubernetes endpoint that you can use with the kubectl client.
- Docker Desktop WSL2 backend on Windows 10. The WSL 2 backend architecture introduces support for Kubernetes.
(One would also potentially mention k3d, basically a minimized Kubernetes cluster running completely on Docker. k3s is the lightweight Kubernetes distribution by Rancher.)
While Minikube is a mature solution that supports most typical Kubernetes features such as DNS, Dashboards, CNI, NodePorts, Config Maps, etc., MicroK8s may appear to be a very (more?) interesting solution to run a fast lightweight and fully equipped upstream CNCF certified Kubernetes infrastructure locally.
As such, MicroK8s can be perceived as more oriented to microservices and more complex stateful setups. For instance, MicroK8s allows you to smoothly leverage:
- Helm, the Kubernetes package manager opening up to the world of all available charts, i.e. curated applications for Kubernetes.
- Kubeless for serverless setups,
- Istio, a very powerful and complex service mesh implementation,
- linkerd, (yet) another service mesh,
- Prometheus for metrics made visible in Grafana,
- jaeger operator,
- etc.
Eventually, at the time of this writing, Docker Desktop WSL 2 backend is experimental.
So, let’s first continue with MicroK8s.
Creating a MicroK8s cluster
MicroK8s provides a single command installation of the latest Kubernetes release on a Linux machine for development and testing. As such, MicroK8s is easy to install and use on Ubuntu or any other Linux distro which supports snaps, i.e. pre-packaged applications (similar to Docker containers).
Although Windows 10 now has some very useful features, such as the ability to install Ubuntu as an app, the integration of Windows Subsystem for Linux 2 (WSL2) doesn’t provide (yet) all the Ubuntu functionalities required to make MicroK8s run smoothly right out-of-the-box (OOB) and thus more specifically use the snap daemon. If you wish to experiment with running MicroK8s semi-natively, see:
- Discourse post Using snapd in WSL2
- Post Running Snaps on WSL2 (Insiders only for now) along with the short YouTube video Use this ONE trick to run Linux Snap packages in Windows Subsystem for Linux 2 (WSL2)
For now, and for the sake of simplicity, you probably would like to run MicroK8s on Windows 10 with virtualization.
As such, MicroK8s will install without problems on Ubuntu on a virtual machine (VM). The Canonical way to get a Linux VM on Windows 10 and to run MicroK8s in it is with multipass.
Multipass gives you an easy to use interface to manage VMs on Windows 10 – Same is true on MacOS and Linux -. On Windows platforms, multipass defaults to using Microsoft Hyper-V as it’s virtualization provider. So, Microsoft Hyper-V is a prerequisite. (You can also take advantage of a local installation of VirtualBox if you want to.) See Instant Ubuntu VMs.
If you’d like to make a try on your own, you can follow the step-by-step guide I prepared for that purpose: Install a MicroK8s single node cluster of Kubernetes on Windows 10.
Let’s now consider Minikube.
Creating a Minikube cluster
Minikube is a tool that also makes it easy to run Kubernetes locally for development and testing. Minikube allows to run a single-node Kubernetes cluster inside a virtual machine (VM) on Hyper-V for anyone looking to try out Kubernetes.
Like for MicroK8s, if you’d like to make a try on your own, you can follow the step-by-step guide I prepared for that purpose: Install a Minikube single node cluster of Kubernetes on Windows 10.
Creating a cluster with Docker Desktop
Docker Desktop WSL 2 represents as of this writing the future of Docker development on Windows using WSL2. See blog post Introducing the Docker Desktop WSL 2 Backend.
For the interest of this article, it provides a welcome support of Kubernetes and, thanks to it, you can now enable Kubernetes when using the WSL 2 backend.
Once again, if you’d like to make a try on your own, you can follow the step-by-step guide I prepared for that purpose: Install and configure WSL2 on Windows 10.
This concludes this article. You should now be equipped to now start using your single node cluster of your choice the way you expect on your Windows 10 machine.
This is great for technical ram-up on Kubernetes, local development, and CI/CD ;-)
Thanks, Philippe
2020-02-05 update: You can now download the guide Install a single node cluster of Kubernetes on Windows 10 – A companion guide for developers. This guide is part of the series New perspectives for cloud-native applications with the Open Application Model (OAM), and the Distributed Application Runtime (Dapr) I published on the Microsoft Download Center (https://aka.ms/CloudNativeAppsFuture).