Kubernetes Components as Windows Services

Some users may wish to configure processes such as flanneld.exe, kubelet.exe, kube-proxy.exe or others to run as Windows services. This brings additional fault-tolerance benefits such as the processes automatically restarting upon an unexpected process or node crash.


  1. You have downloaded nssm.exe into the c:\k directory
  2. You have joined the node to your cluster and run the install.ps1 or start.ps1 script on your node previously

Registering Windows services

You can run a sample script which uses nssm.exe that will register kubelet, kube-proxy, and flanneld.exe to run as Windows services in the background:

C:\k\register-svc.ps1 -NetworkMode <Network mode> -ManagementIP <Windows Node IP> -ClusterCIDR <Cluster subnet> -KubeDnsServiceIP <Kube-dns Service IP> -LogDir <Directory to place logs>

The IP address assigned to the Windows node. You can use ipconfig to find this.

Parameter -ManagementIP
Default Value n.A.


Should something go wrong, please consult the troubleshooting section

Manual Approach

Should the above referenced script not work for you, this section provides some sample commands which can be used to register these services manually step-by-step.


See Kubelet and kube-proxy can now run as Windows services for more details on how to configure kubelet and kube-proxy to run as native Windows services via sc.

Register flanneld.exe

nssm install flanneld C:\flannel\flanneld.exe
nssm set flanneld AppParameters --kubeconfig-file=c:\k\config --iface=<ManagementIP> --ip-masq=1 --kube-subnet-mgr=1
nssm set flanneld AppEnvironmentExtra NODE_NAME=<hostname>
nssm set flanneld AppDirectory C:\flannel
nssm start flanneld

Register kubelet.exe

nssm install kubelet C:\k\kubelet.exe
nssm set kubelet AppParameters --hostname-override=<hostname> --v=6 --pod-infra-container-image=kubeletwin/pause --resolv-conf="" --allow-privileged=true --enable-debugging-handlers --cluster-dns=<DNS-service-IP> --cluster-domain=cluster.local --kubeconfig=c:\k\config --hairpin-mode=promiscuous-bridge --image-pull-progress-deadline=20m --cgroups-per-qos=false  --log-dir=<log directory> --logtostderr=false --enforce-node-allocatable="" --network-plugin=cni --cni-bin-dir=c:\k\cni --cni-conf-dir=c:\k\cni\config
nssm set kubelet AppDirectory C:\k
nssm start kubelet

Register kube-proxy.exe (l2bridge / host-gw)

nssm install kube-proxy C:\k\kube-proxy.exe
nssm set kube-proxy AppDirectory c:\k
nssm set kube-proxy AppParameters --v=4 --proxy-mode=kernelspace --hostname-override=<hostname>--kubeconfig=c:\k\config --enable-dsr=false --log-dir=<log directory> --logtostderr=false
nssm.exe set kube-proxy AppEnvironmentExtra KUBE_NETWORK=cbr0
nssm set kube-proxy DependOnService kubelet
nssm start kube-proxy

Register kube-proxy.exe (overlay / vxlan)

PS C:\k> nssm install kube-proxy C:\k\kube-proxy.exe
PS C:\k> nssm set kube-proxy AppDirectory c:\k
PS C:\k> nssm set kube-proxy AppParameters --v=4 --proxy-mode=kernelspace --feature-gates="WinOverlay=true" --hostname-override=<hostname> --kubeconfig=c:\k\config --network-name=vxlan0 --source-vip=<source-vip> --enable-dsr=false --log-dir=<log directory> --logtostderr=false
nssm set kube-proxy DependOnService kubelet
nssm start kube-proxy