Skip to content
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

kubelet不断重启:mountpoint for cpu not found #640

Open
xpendous opened this issue Mar 4, 2022 · 2 comments
Open

kubelet不断重启:mountpoint for cpu not found #640

xpendous opened this issue Mar 4, 2022 · 2 comments

Comments

@xpendous
Copy link

xpendous commented Mar 4, 2022

文档版本
k8s v1.6.6
containerd 1.6.1
centos stream 9 ARM版本

现象描述
kubelet不断重启
journalctl -u kubelet有如下报错:
server.go:605] failed to get the kubelet's cgroup: mountpoint for cpu not found.
server.go:271] failed to run Kubelet: mountpoint for cpu not found
kubelet.service: Main process exited, code=exited, status=255/EXCEPTION
kubelet.service: Failed with result 'exit-code'.
Stopped Kubernetes Kubelet.

或者命令行直接输入kubelet有如下报错:
I0305 15:57:27.329438 16240 server.go:410] Version: v1.16.6
I0305 15:57:27.329642 16240 plugins.go:100] No cloud provider specified.
W0305 15:57:27.329660 16240 server.go:549] standalone mode, no API client
W0305 15:57:27.329702 16240 server.go:605] failed to get the kubelet's cgroup: mountpoint for cpu not found. Kubelet system container metrics may be missing.
F0305 15:57:27.331958 16240 server.go:271] failed to run Kubelet: mountpoint for cpu not found

@xpendous
Copy link
Author

xpendous commented Mar 5, 2022

#centos stream 9 默认使用cgroup2#
[root@cs9-01 ~]# grep cgroup /etc/mtab
cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot 0 0
[root@cs9-01 ~]#
[root@cs9-01 ~]# ll /sys/fs/cgroup
total 0
-r--r--r-- 1 root root 0 Mar 5 18:14 cgroup.controllers
-rw-r--r-- 1 root root 0 Mar 5 18:22 cgroup.max.depth
-rw-r--r-- 1 root root 0 Mar 5 18:22 cgroup.max.descendants
-rw-r--r-- 1 root root 0 Mar 5 18:14 cgroup.procs
-r--r--r-- 1 root root 0 Mar 5 18:22 cgroup.stat
-rw-r--r-- 1 root root 0 Mar 5 18:14 cgroup.subtree_control
-rw-r--r-- 1 root root 0 Mar 5 18:22 cgroup.threads
-rw-r--r-- 1 root root 0 Mar 5 18:22 cpu.pressure
-r--r--r-- 1 root root 0 Mar 5 18:22 cpuset.cpus.effective
-r--r--r-- 1 root root 0 Mar 5 18:22 cpuset.mems.effective
-r--r--r-- 1 root root 0 Mar 5 18:22 cpu.stat
drwxr-xr-x 2 root root 0 Mar 5 18:14 dev-hugepages.mount
drwxr-xr-x 2 root root 0 Mar 5 18:14 dev-mqueue.mount
drwxr-xr-x 2 root root 0 Mar 5 18:14 init.scope
-rw-r--r-- 1 root root 0 Mar 5 18:22 io.pressure
-r--r--r-- 1 root root 0 Mar 5 18:22 io.stat
-r--r--r-- 1 root root 0 Mar 5 18:22 memory.numa_stat
-rw-r--r-- 1 root root 0 Mar 5 18:22 memory.pressure
-r--r--r-- 1 root root 0 Mar 5 18:22 memory.stat
-r--r--r-- 1 root root 0 Mar 5 18:22 misc.capacity
drwxr-xr-x 2 root root 0 Mar 5 18:14 sys-fs-fuse-connections.mount
drwxr-xr-x 2 root root 0 Mar 5 18:14 sys-kernel-config.mount
drwxr-xr-x 2 root root 0 Mar 5 18:14 sys-kernel-debug.mount
drwxr-xr-x 2 root root 0 Mar 5 18:14 sys-kernel-tracing.mount
drwxr-xr-x 47 root root 0 Mar 5 18:30 system.slice
drwxr-xr-x 3 root root 0 Mar 5 18:14 user.slice

@MiV1N
Copy link

MiV1N commented Jun 13, 2024

这个回答可能对题主没有帮助了,我在网上直接搜索,这个页面提的问题在搜索上面排名很高,但是没有人回答,给一个我这边遇到的问题原因,希望后面有相同问题的人可以少花点时间。

原因:

Kubernetes 从 1.19 起支持 v2 版本,如需运行 1.19 之前的老版本,需要宿主机 Docker 使用 cgroup v1
https://kind.sigs.k8s.io/docs/user/known-issues/#failure-to-create-cluster-with-cgroups-v2

我宿主机是ubuntu22.04,而ubuntu自21.04版本后的版本(不包含21.04)linux内核改用了v2版本,拉起的k8s是1.17.17的版本,还是使用的cgroup v1

解决方案:

  1. 切换使用cgroup v1的系统
  2. 把v2的系统切换为使用cgroupv1
ubuntu@ubuntu:~$ vim /etc/default/grub
GRUB_CMDLINE_LINUX="systemd.unified_cgroup_hierarchy=0"

ubuntu@ubuntu:~$ sudo update-grub
ubuntu@ubuntu:~$ sudo reboot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants