kubeadm: kubeadm.exe fails on Windows Server 2022
BUG REPORT
Versions
kubeadm version: &version.Info{Major:"1", Minor:"29", GitVersion:"v1.29.4", GitCommit:"55019c83b0fd51ef4ced8c29eec2c4847f896e74", GitTreeState:"clean", BuildDate:"2024-04-16T15:05:51Z", GoVersion:"go1.21.9", Compiler:"gc", Platform:"windows/amd64"}
Environment:
Existing kubeadm cluster based on four Linux nodes running Ubuntu 22.04 as VMware VMs. Cluster works fine and everything is updated recently to Kubernetes version 1.29.4.
All nodes have 16 cores and 64 GB memory. They run containerd and networking is Calico. We use an external Ubuntu host running HA Proxy as a load balancer for the API server. The four node cluster works fine.
What happened?
We need support for Windows containers as well, so I’m trying to add a Windows Server 2022 based host to the cluster. And this is where the fun starts. The new Windows host has 16 cores/64 GB as well, and it’s running in the same VMware cluster.
I hope (and believe) I’ve done the preparation of the Win host properly - primarily based on documentation from these sources:
https://k8s-docs.netlify.app/en/docs/setup/production-environment/windows/user-guide-windows-nodes/ https://docs.tigera.io/calico/latest/getting-started/kubernetes/windows-calico/operator
But when I try to run
PS C:\Windows\system32> kubeadm join kube-cph.bogus.com:6443 --token ue62yc.ks285c6i4vr4cy1n --discovery-token-ca-cert-hash sha256:8deeb01d3a1a7fbad9d3708405c503d458f32beba5b36294a284cce8d46fbf1f
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR IsPrivilegedUser]: user is not running as administrator
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher
I am running as a user with Admin permissions and in a PowerShell session with elevated permissions. Every utility we can think of confirms that this is a session with full administrative rights.
If I ignore the error above, preflight will continue and emit a whole cascade of new errors, all Linux related and all showing clear signs that kubeadm believes it’s running on Linux.
But nevertheless
kubeadm version: &version.Info{Major:"1", Minor:"29", GitVersion:"v1.29.4", GitCommit:"55019c83b0fd51ef4ced8c29eec2c4847f896e74", GitTreeState:"clean", BuildDate:"2024-04-16T15:05:51Z", GoVersion:"go1.21.9", Compiler:"gc", Platform:"windows/amd64"}
states that platform is “windows/amd64”.
What you expected to happen?
I would expect the node to join the cluster.
How to reproduce it (as minimally and precisely as possible)?
Create a new Linux based kubeadm cluster. Verify that it runs fine. Setup a new Windows Server 2022 host with containerd. Try to add it to the cluster using kubeadm join.
Anything else we need to know?
I have asked for help in the Slack channel “Kubernetes/kubeadm”, but except for friendly interest I’ve had no response.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 21 (12 by maintainers)
Eh - yes - I very much agree on that.
My comment was about trying to emphasize the importance of this problem: Even though it can be solved by adding people as local admins, this is an insecure and error prone workaround.
But that doesn’t matter now: You seem to have found an excellent solution.
this works and it’s the canonical UAC way:
IsElevated() calls GetTokenInformation with TOKEN_ELEVATION which is valid; https://cs.opensource.google/go/x/sys/+/refs/tags/v0.19.0:windows/security_windows.go;l=759
i will change the kubeadm preflight check to this in 1.31.
yes, i edited my comment as i forgot that kubeadm is used in CAPZ.
my guess is the following:
kubeadm has some service manager code (on Linux this “init system” is systemd) to start the kubelet. https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/util/initsystem/initsystem_windows.go
it uses
golang.org/x/sys/windows/svc/mgrwhich wraps theOpenSCManager/OpenServiceWINAPI https://learn.microsoft.com/en-us/windows/win32/services/starting-a-service, and it think it fails if the user is not in theS-1-5-32-544group.i don’t think we should move away from managing the kubelet as a service or stop using
golang.org/x/sys/windows/svc/mgr, so this seems to be a requirement and wont-fix.