kubelet与kubelet cgroup驱动程序失败:“cgroupfs”与docker cgroup驱动程序不同:“systemd”

cgroup drive 的配置正好在/etc/systemd/system/kubelet.service.d/10-kubeadm.conf中

环境=“KUBELET_CGROUP_ARGS = - cgroup-driver = systemd”

我还用cli检查了 Environment

$ systemctl show --property =环境kubelet | cat环境= KUBELET_KUBECONFIG_ARGS = - kubeconfig = / etc / kubernetes / kubelet.conf \ x20 - require-kubeconfig = true KUBELET_SYSTEM_PODS_ARGS = - pod-manifest-path = / etc / kubernetes / manifests \ x20 - allow-privileged = true KUBELET_NETWORK_ARGS = - network-plugin = cni \ x20 - cni-conf-dir = / etc / cni / net.d \ x20 - cni-bin-dir = / opt / cni / bin KUBELET_DNS_ARGS = - cluster- dns = 10.96.0.10 \ x20 - cluster-domain = cluster.local KUBELET_AUTHZ_ARGS = - authorization-mode = Webhook \ x20 - client-ca-file = / etc / kubernetes / pki / ca.crt KUBELET_CADVISOR_ARGS = - cadvisor -port = 0 KUBELET_CGROUP_ARGS = - cgroup-driver = systemd

How to reproduce it

  • yum install -y docker-1.12.6

  • systemctl启用docker && systemctl启动docker

  • setenforce 0

  • yum install -y kubelet kubeadm

  • systemctl启用kubelet && systemctl start kubelet

  • systemctl daemon-reload

  • systemctl重启kubelet

  • kubelet日志

Environment

  • Kubernetes版本(使用 kubectl version ):1.7.3

  • Cloud 提供商或硬件配置**:4核16G RAM

  • 操作系统(例如来自/ etc / os-release):CentOS Linux 7(核心版)

  • 内核(例如 uname -a ):Linux 10-8-108-92 3.10.0-327.22.2.el7.x86_64#1 SMP Thu Jun 23 17:05:11 UTC 2016 x86_64 x86_64 x86_64 GNU / Linux

  • 安装工具:kubeadm

回答(5)

3 years ago

可能的原因

kubelet 1.7.3 not reading config file /etc/systemd/system/kubelet.service.d/10-kubeadm.conf #50748

解决方案

Troubleshooting kubeadm

如果您在设置主节点时使用CentOS并遇到困难,请验证您的Docker cgroup驱动程序是否与kubelet配置匹配:

docker info | grep -i cgroup
cat /etc/systemd/system/kubelet.service.d/10-kubeadm.conf

如果Docker cgroup驱动程序和kubelet配置不匹配,请更改kubelet配置以匹配Docker cgroup驱动程序 . 您需要更改的标志是--cgroup-driver . 如果已经设置,您可以像这样更新:

sed -i "s/cgroup-driver=systemd/cgroup-driver=cgroupfs/g /etc/systemd/system/kubelet.service.d/10-kubeadm.conf

这可以替换为:

CG=$(sudo docker info 2>/dev/null | sed -n 's/Cgroup Driver: \(.*\)/\1/p')
sed -i "s/cgroup-driver=systemd/cgroup-driver=$CG/g" /etc/systemd/system/kubelet.service.d/10-kubeadm.conf

3 years ago

看起来kubelet进程没有从错误消息中的 /etc/systemd/system/kubelet.service.d/10-kubeadm.conf 加载正确的设置 .

从聊天中获取更多信息后,我认为有几种可能的方法:

  • 将kubelet和docker cgroup驱动程序切换到 cgroupfs 从默认情况下使用 cgroupfs 的repo下载docker .
[dockerrepo] 
name=Docker Repository 
baseurl=https://yum.dockerproject.org/repo/main/centos/7 
enabled=1 
gpgcheck=1 
gpgkey=https://yum.dockerproject.org/gpg

并在kubelet conf中更改cgroup驱动程序 . 检查错误是否再次发生以及从其conf中加载的kubelet .

  • 在kubelet代码中添加更多日志以进行调试

This是逻辑kubelet用来从双方获取conf

3 years ago

编辑此文件 /etc/systemd/system/kubelet.service.d/10-kubeadm.confsystemd 更改为 cgroupfs “ . 然后重新启动kubelet systemctl restart kubelet .

3 years ago

要让CentOS 7上运行minicube,我需要按照https://github.com/kubernetes/minikube/issues/2192中的建议使用 --extra-config=kubelet.cgroup-driver=systemd 启动它 .

3 years ago

首先安装docker:

yum install -y https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-selinux-17.03.0.ce-1.el7.centos.noarch.rpm

yum install -y https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.03.0.ce-1.el7.centos.x86_64.rpm

[root@cgfs-dock ~]# docker info | grep -i cgroup
Cgroup Driver: cgroupfs

然后安装kubelet,这将解决您的问题 .