-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
k3s server failed to start in an alpine docker container on a Mac with M1 CPU #4720
Comments
Unfortunately you've not included whatever's above. Can you do so? Ultimately this is somewhere in upstream or a 3rd party library though, so we'll need to figure out where and likely open an issue there. |
The full error output was in "Describe the bug" (the extreme long line). I pasted it at here again: E1210 23:15:23.627061 1 server.go:288] "Failed to run kubelet" err="failed to run Kubelet: could not detect clock speed from output: "processor\t: 0\nBogoMIPS\t: 48.00\nFeatures\t: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp flagm2 frint\nCPU implementer\t: 0x00\nCPU architecture: 8\nCPU variant\t: 0x0\nCPU part\t: 0x000\nCPU revision\t: 0\n\nprocessor\t: 1\nBogoMIPS\t: 48.00\nFeatures\t: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp flagm2 frint\nCPU implementer\t: 0x00\nCPU architecture: 8\nCPU variant\t: 0x0\nCPU part\t: 0x000\nCPU revision\t: 0\n\nprocessor\t: 2\nBogoMIPS\t: 48.00\nFeatures\t: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp flagm2 frint\nCPU implementer\t: 0x00\nCPU architecture: 8\nCPU variant\t: 0x0\nCPU part\t: 0x000\nCPU revision\t: 0\n\nprocessor\t: 3\nBogoMIPS\t: 48.00\nFeatures\t: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp flagm2 frint\nCPU implementer\t: 0x00\nCPU architecture: 8\nCPU variant\t: 0x0\nCPU part\t: 0x000\nCPU revision\t: 0\n\n"" |
You've installed k3s from the Alpine community channel which is not maintained by the k3s team. This bug report would be more useful over at https://gitlab.alpinelinux.org/alpine/aports. Please be aware that there are caveats when using this alternate packaging of k3s, specifically the I have yet to try k3s with docker desktop on my M1 minis but I would be surprised if it did not work. As such, I encourage you to give the docker.io/rancher/k3s image a try. These are the images that the rancher/k3d project leverages by default. |
@updogliu I went ahead and created https://gitlab.alpinelinux.org/alpine/aports/-/issues/13300 |
In addition to what Jacob noted above, the cpuinfo in your Docker container does appear to be bogus; other than the features all the fields are just 0. |
So, as per https://gitlab.alpinelinux.org/alpine/aports/-/issues/13300#note_197830 ...
Does https://docs.docker.com/desktop/mac/apple-silicon/ not run with an arm64 VM by default? |
For some reason, our image (base on Alpine 3.14.2) only has an Docker Desktop support running |
Can you try running an arm64 image instead? Maybe just our image at rancher/k3s? It sounds like the qemu-based amd64 emulation is incomplete in a number of ways that are incompatible with running Kubernetes. |
Thanks for the suggestions, @brandond. FYI, an arm64 alpine image installed k3s via However, that is a non-option to us, because we need to run k8s pods using some amd64-only images (a typical one is MySQL-5.7). And we did some customizations base on a vanilla alpine OS (apk installs, dns resolvers, etc.), which are not straightforward to migrate to a heavily pruned image like rancher/k3s. That said, I can give a try if I can see the source Dockerfile building the rancher/k3s image. Where can I find it? |
Right here in this repo. You'll need to follow the building instructions; the image is produced at Line 17 in 2f3bfc2
Given the problems that the docker for mac apparently has in emulating amd64, I would probably not expect to get amd64 working. Even if you rebuild it yourself that won't change anything about the underlying issue with qemu's broken /proc/cpuinfo not meeting the needs of the kubelet. |
Thanks, @brandond. Is it possible / make sense to implement the handling of |
No, because the code in question is not in K3s. It is the upstream Kubernetes kubelet code that is erroring out. |
I see. So basically we are stuck with the qemu issue of wrong |
As long as you are running emulated amd64, yes. |
This repository uses a bot to automatically label issues which have not had any activity (commit/comment/label) for 180 days. This helps us manage the community issues better. If the issue is still relevant, please add a comment to the issue so the bot can remove the label and we know it is still valid. If it is no longer relevant (or possibly fixed in the latest release), the bot will automatically close the issue in 14 days. Thank you for your contributions. |
Did you guys find a workaround for running |
There's some hope that maybe now that Rosetta emulation is used instead of QEMU this will be fixed, but for now it sadly doesn't look like it, see: If anyone has a workaround, please share. Even if it involves setting up virtualbox or something like that. |
One more thought based on these comments above:
Could an issue be made in https://github.com/kubernetes/kubernetes or a similar repo to not require clock speed? |
Environmental Info:
Host OS: Mac OS 12.0.1 Monterey
Docker version on Host:
K3s Version:
Node(s) CPU architecture, OS, and Version:
In an alpine container
Cluster Configuration:
1 server
Describe the bug:
k3s start
reports errorSteps To Reproduce:
apk add -U k3s
Expected behavior:
k3s server
can start the server without errors.Actual behavior:
Exited with an error
The text was updated successfully, but these errors were encountered: