How to setup Kubernetes cluster on several windows hosts?

3/2/2022

I have several Windows servers available and would like to setup a Kubernetes cluster on them. Is there some tool or a step by step instruction how to do so?

What I tried so far is to install DockerDesktop and enable its Kubernetes feature. That gives me a single node Cluster. However, adding additional nodes to that Docker-Kubernetes Cluster (from different Windows hosts) does not seem to be possible: https://stackoverflow.com/questions/54658194/docker-desktop-kubernetes-add-node

Should I first create a Docker Swarm and could then run Kubernetes on that Swarm? Or are there other strategies?

I guess that I need to open some ports in the Windows Firewall Settings of the hosts? And map those ports to some Docker containers in which Kubernetes is will be installed? What ports?

Is there some program that I could install on each Windows host and that would help me with setting up a network with multiple hosts and connecting the Kubernetes nodes running inside Docker containers? Like a "kubeadm for Windows"?

Would be great if you could give me some hint on the right direction.

Edit:<br> Related info about installing kubeadm inside Docker container:<br> https://github.com/kubernetes/kubernetes/issues/35712<br> https://github.com/kubernetes/kubeadm/issues/17

Related question about Minikube:<br> https://stackoverflow.com/questions/51821057/adding-nodes-to-a-windows-minikube-kubernetes-installation-how

Info on kind (kubernetes in docker) multi-node cluster:<br> https://dotnetninja.net/2021/03/running-a-multi-node-kubernetes-cluster-on-windows-with-kind/ (Creates multi-node kubernetes cluster on single windows host)<br> Also see:

-- Stefan
docker
kubernetes
windows

1 Answer

3/3/2022

You can always refer to the official kubernetes documentation which is the right source for the information.

This is the correct way to manage this question.

Based on Adding Windows nodes, you need to have two prerequisites:

  • Obtain a Windows Server 2019 license (or higher) in order to configure the Windows node that hosts Windows containers. If you are using VXLAN/Overlay networking you must have also have KB4489899 installed.

  • A Linux-based Kubernetes kubeadm cluster in which you have access to the control plane (see Creating a single control-plane cluster with kubeadm).

Second point is especially important since all control plane components are supposed to be run on linux systems (I guess you can run a Linux VM on one of the servers to host a control plane components on it, but networking will be much more complicated).

And once you have a proper running control plane, there's a kubeadm for windows to proper join Windows nodes to the kubernetes cluster. As well as a documentation on how to upgrade windows nodes.

For firewall and which ports should be open check ports and protocols.

For worker node (which will be windows nodes):

Protocol	Direction	Port Range	  Purpose	         Used By
TCP	        Inbound	    10250	      Kubelet API     	 Self, Control plane
TCP	        Inbound	    30000-32767	  NodePort Services	 All

Another option can be running windows nodes in cloud managed kuberneres, for example GKE with windows node pool (yes, I understand that it's not your use-case, but for further reference).

-- moonkotte
Source: StackOverflow