Run k0s worker nodes in Windows

IMPORTANT: Windows support for k0s is under active development and must be considered experimental.

Prerequisites

The cluster must be running at least one worker node and control plane on Linux. You can use Windows to run additional worker nodes.

Run k0s

Note: The k0s.exe supervises kubelet.exe and kube-proxy.exe.

During the first run, the calico install script is created as C:\bootstrap.ps1. This bootstrap script downloads the calico binaries, builds pause container and sets up vSwitch settings.

Install Mirantis Container Runtime on the Windows node(s), as it is required for the initial Calico set up).

  1. k0s worker --cri-socket=remote:npipe:////./pipe/containerd-containerd --cidr-range=<cidr_range> --cluster-dns=<clusterdns> --api-server=<k0s api> <token>

You must initiate the Cluster control with the correct config.

Configuration

Strict-affinity

You must enable strict affinity to run the windows node.

If the spec.network.calico.withWindowsNodes field is set to true (it is set to false by default) the additional calico related manifest /var/lib/k0s/manifests/calico/calico-IPAMConfig-ipamconfig.yaml is created with the following values:

  1. ---
  2. apiVersion: crd.projectcalico.org/v1
  3. kind: IPAMConfig
  4. metadata:
  5. name: default
  6. spec:
  7. strictAffinity: true

Alternately, you can manually execute calicoctl:

  1. calicoctl ipam configure --strictaffinity=true

Network connectivity in AWS

Disable the Change Source/Dest. Check option for the network interface attached to your EC2 instance. In AWS, the console option for the network interface is in the Actions menu.

Hacks

k0s offers the following CLI arguments in lieu of a formal means for passing cluster settings from controller plane to worker:

  • cidr-range
  • cluster-dns
  • api-server

Useful commands

Run pod with cmd.exe shell

  1. kubectl run win --image=hello-world:nanoserver --command=true -i --attach=true -- cmd.exe

Manifest for pod with IIS web-server

  1. apiVersion: v1
  2. kind: Pod
  3. metadata:
  4. name: iis
  5. spec:
  6. containers:
  7. - name: iis
  8. image: mcr.microsoft.com/windows/servercore/iis
  9. imagePullPolicy: IfNotPresent