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. Supported Windows versions: Windows Server 2019 and Windows Server 2022.
Installation#
1. Generate worker token from control plane#
On your Linux control plane node, generate a worker token:
k0s token create --role=worker > worker-token.txt
Transfer this worker-token.txt file to your Windows node at C:\k0s-token.txt.
2. Enable Windows Containers feature#
Open PowerShell as Administrator on the Windows node and run:
Install-WindowsFeature -Name Containers
Note: A system reboot is required after enabling this feature.
3. Download and install k0s#
After rebooting, open PowerShell as Administrator and run:
# Set variables
$K0S_VERSION = "v1.34.3+k0s.0"
$TOKEN_FILE = "C:\k0s-token.txt"
# Download k0s
$encodedVersion = $K0S_VERSION.Replace('+', '%2B')
$url = "https://github.com/k0sproject/k0s/releases/download/$encodedVersion/k0s-$K0S_VERSION-amd64.exe"
Invoke-WebRequest -Uri $url -OutFile "$env:LOCALAPPDATA\Microsoft\WindowsApps\k0s.exe"
# Install and start k0s worker
k0s install worker --token-file $TOKEN_FILE
k0s start
Note: k0s supervises kubelet.exe and kube-proxy.exe.
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.
Useful commands#
Run pod with cmd.exe shell#
kubectl run win --image=hello-world:nanoserver --command=true -i --attach=true -- cmd.exe
Manifest for pod with IIS web-server#
apiVersion: v1
kind: Pod
metadata:
name: iis
spec:
containers:
- name: iis
image: mcr.microsoft.com/windows/servercore/iis
imagePullPolicy: IfNotPresent