【问题标题】:kubelet failed to find mountpoint for CPUkubelet 找不到 CPU 的挂载点
【发布时间】:2020-01-05 18:27:44
【问题描述】:

我在 Debian 10 buster 5.2.9-2 上使用 kubeadm 1.15.3、docker-ce 18.09,并在 journalctl -xe | grep kubelet 中看到错误:

server.go:273] 运行 Kubelet 失败:找不到 cpu 的挂载点

我的/sys/fs/cgroup 包含:

-r--r--r--  1 root root 0 Sep  2 18:49 cgroup.controllers
-rw-r--r--  1 root root 0 Sep  2 18:50 cgroup.max.depth
-rw-r--r--  1 root root 0 Sep  2 18:50 cgroup.max.descendants
-rw-r--r--  1 root root 0 Sep  2 18:49 cgroup.procs
-r--r--r--  1 root root 0 Sep  2 18:50 cgroup.stat
-rw-r--r--  1 root root 0 Sep  2 18:49 cgroup.subtree_control
-rw-r--r--  1 root root 0 Sep  2 18:50 cgroup.threads
-rw-r--r--  1 root root 0 Sep  2 18:50 cpu.pressure
-r--r--r--  1 root root 0 Sep  2 18:50 cpuset.cpus.effective
-r--r--r--  1 root root 0 Sep  2 18:50 cpuset.mems.effective
drwxr-xr-x  2 root root 0 Sep  2 18:49 init.scope
-rw-r--r--  1 root root 0 Sep  2 18:50 io.pressure
-rw-r--r--  1 root root 0 Sep  2 18:50 memory.pressure
drwxr-xr-x 20 root root 0 Sep  2 18:49 system.slice
drwxr-xr-x  2 root root 0 Sep  2 18:49 user.slice

docker.service 运行正常并且有/etc/docker/daemon.json

{
  "exec-opts": [
    "native.cgroupdriver=systemd"
  ],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2"
}

kubeadm 文档说,如果使用 docker,cgroup 驱动程序将被自动检测,但我还是尝试提供它以获得良好的衡量标准 - 没有变化。

使用mountcgroupfs-mount

$ mount -t cgroup -o all cgroup /sys/fs/cgroup
mount: /sys/fs/cgroup: cgroup already mounted on /sys/fs/cgroup/cpuset.
$ cgroupfs-mount
mount: /sys/fs/cgroup/cpu: cgroup already mounted on /sys/fs/cgroup/cpuset.
mount: /sys/fs/cgroup/blkio: cgroup already mounted on /sys/fs/cgroup/cpuset.
mount: /sys/fs/cgroup/memory: cgroup already mounted on /sys/fs/cgroup/cpuset.
mount: /sys/fs/cgroup/pids: cgroup already mounted on /sys/fs/cgroup/cpuset.

问题出在cpuset 而不是cpu?我试图创建一个符号链接,但 root 没有/sys/fs/cgroup 的写权限。 (大概我可以改变它,但我认为这是足够的警告,不要干预。)

如何让 kubelet 找到我的 CPU cgroup mount?

【问题讨论】:

    标签: linux docker kubernetes cgroups kubelet


    【解决方案1】:

    我会说你的docker-ce 安装很奇怪,而不是kubelet。您正在寻找显示映射问题的正确方向。

    我在GCPAWS 环境实例上都尝试了3 个不同的docker 版本。 我注意到比较我们的结果 - 您在 /sys/fs/cgroup 下的文件夹结构错误。请注意,与您的输出相比,我在 /sys/fs/cgroup 中拥有更多权限。这是我的结果的样子:

    root@instance-3:~# docker version
    Client: Docker Engine - Community
     Version:           19.03.1
     API version:       1.39 (downgraded from 1.40)
     Go version:        go1.12.5
     Git commit:        74b1e89
     Built:             Thu Jul 25 21:21:24 2019
     OS/Arch:           linux/amd64
     Experimental:      false
    
    Server: Docker Engine - Community
     Engine:
      Version:          18.09.1
      API version:      1.39 (minimum version 1.12)
      Go version:       go1.10.6
      Git commit:       4c52b90
      Built:            Wed Jan  9 19:02:44 2019
      OS/Arch:          linux/amd64
      Experimental:     false
    
    
    root@instance-3:~# ls -la /sys/fs/cgroup
    total 0
    drwxr-xr-x 14 root root 360 Sep  3 11:30 .
    drwxr-xr-x  6 root root   0 Sep  3 11:30 ..
    dr-xr-xr-x  5 root root   0 Sep  3 11:30 blkio
    lrwxrwxrwx  1 root root  11 Sep  3 11:30 cpu -> cpu,cpuacct
    dr-xr-xr-x  5 root root   0 Sep  3 11:30 cpu,cpuacct
    lrwxrwxrwx  1 root root  11 Sep  3 11:30 cpuacct -> cpu,cpuacct
    dr-xr-xr-x  2 root root   0 Sep  3 11:30 cpuset
    dr-xr-xr-x  5 root root   0 Sep  3 11:30 devices
    dr-xr-xr-x  2 root root   0 Sep  3 11:30 freezer
    dr-xr-xr-x  5 root root   0 Sep  3 11:30 memory
    lrwxrwxrwx  1 root root  16 Sep  3 11:30 net_cls -> net_cls,net_prio
    dr-xr-xr-x  2 root root   0 Sep  3 11:30 net_cls,net_prio
    lrwxrwxrwx  1 root root  16 Sep  3 11:30 net_prio -> net_cls,net_prio
    dr-xr-xr-x  2 root root   0 Sep  3 11:30 perf_event
    dr-xr-xr-x  5 root root   0 Sep  3 11:30 pids
    dr-xr-xr-x  2 root root   0 Sep  3 11:30 rdma
    dr-xr-xr-x  5 root root   0 Sep  3 11:30 systemd
    dr-xr-xr-x  5 root root   0 Sep  3 11:30 unified
    
    
    
    root@instance-3:~# ls -la /sys/fs/cgroup/unified/
    total 0
    dr-xr-xr-x  5 root root   0 Sep  3 11:37 .
    drwxr-xr-x 14 root root 360 Sep  3 11:30 ..
    -r--r--r--  1 root root   0 Sep  3 11:42 cgroup.controllers
    -rw-r--r--  1 root root   0 Sep  3 11:42 cgroup.max.depth
    -rw-r--r--  1 root root   0 Sep  3 11:42 cgroup.max.descendants
    -rw-r--r--  1 root root   0 Sep  3 11:30 cgroup.procs
    -r--r--r--  1 root root   0 Sep  3 11:42 cgroup.stat
    -rw-r--r--  1 root root   0 Sep  3 11:42 cgroup.subtree_control
    -rw-r--r--  1 root root   0 Sep  3 11:42 cgroup.threads
    drwxr-xr-x  2 root root   0 Sep  3 11:30 init.scope
    drwxr-xr-x 52 root root   0 Sep  3 11:30 system.slice
    drwxr-xr-x  3 root root   0 Sep  3 11:30 user.slice
    

    鼓励您从头开始完全重新安装 docker(或重新创建实例并再次安装 docker)。那应该有帮助。 跟大家分享一下我的docker-ce安装步骤:

    $ sudo apt update
    $ sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
    $ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
    $ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
    $ sudo apt update
    $ apt-cache policy docker-ce
    $ sudo apt install docker-ce=5:18.09.1~3-0~debian-buster
    

    我也在Kubelet: mountpoint for cpu not found问题答案中看到了一个workaroung,但也没有root权限来修复它:

    mkdir /sys/fs/cgroup/cpu,cpuacct
    mount -t cgroup -o cpu,cpuacct none /sys/fs/cgroup/cpu,cpuacct
    

    【讨论】:

    • 谢谢,我确实看到了这个问题,但我在cpu,cpuacct 中遇到了与cpu 相同的“已安装”错误。我还注意到我没有 /sys/fs/cgroup/systemd,你这样做了,而且我读到这些挂载点应该由 systemd 创建。
    猜你喜欢
    • 2023-01-18
    • 2019-06-17
    • 2014-11-19
    • 2017-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多