Kubernetes with Windows Nodes

Mike Koziel
4 min readNov 29, 2020

--

Oh, the agony and celebration of getting Windows nodes joined to a Kubernetes cluster. This article dives into some of the challenges I faced and their resolution in the quest to get scalable, self-healing windows containers running within a Kubernetes cluster.

Preparing the Master node

There are many how-to articles for prepping a Kubernetes cluster to accept Windows nodes. They seem to be all over the map in terms of preparation steps one performs prior to calling the final “kubectl join” command. Here was the magic combination that worked for our environment.

On the Master Node:

  1. Download the latest flannel CNI from: https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
  2. Modify the net-conf.json section of the flannel manifest in order to set the backend type to “host-gw”. It should look as follows:

net-conf.json: { “Network”: “10.244.0.0/16”, “Backend”: { “Type”: “host-gw”}}

3. Apply the kube-flannel.yml:

kubectl apply -f kube-flannel.yml

4. Add Windows Flannel and Kube-Proxy DaemonSet for Windows Nodes

curl -L https://github.com/kubernetes-sigs/sig-windows-tools/releases/latest/download/kube-proxy.yml | sed ‘s/VERSION/v1.19.3/g’ | kubectl apply -f -

kubectl apply -f https://github.com/kubernetes-sigs/sig-windows-tools/releases/latest/download/flannel-host-gw.yml

Preparing the Windows Node

Next, we’ll want to get the required components installed on the windows nodes. The following assumes that the windows node already has an up-to-date version of docker running on the system and able to host containers.

  1. Create the directory “c:\k” and open up a command line window in that directory. Make sure you run as Administrator to get access to all of the docker and networking components.
  2. Grab the latest Preparation script from the Kubernetes Sig group.

curl.exe -LO https://github.com/kubernetes-sigs/sig-windows-tools/releases/latest/download/PrepareNode.ps1

--

--

Mike Koziel

I am a longtime software builder, fly fisher and professional musician. Living in Montana allows me to follow all of my passions in life.