1. Docker 与 K8s CgroupDriver 不一致

1.1. 错误现场

minikube start 的异常报错

W1110 17:26:39.009852   18945 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]
    [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/

kubelet 的日志报错

11月 10 17:26:45 skiff-env1 kubelet[19938]: F1110 17:26:45.168187   19938 server.go:274] failed to run Kubelet: misconfiguration: kubelet cgroup driver: "systemd" is different from docker cgroup driver: "cgroupfs"

1.2. 问题分析

这是由于 kubelet 和 docker 的 cgropu driver 不一致导致的

1.3. 修复方法

1.3.1. 方案1: 修改 docker 的 Cgroup Driver

# cat /etc/docker/daemon.json 
  "exec-opts": ["native.cgroupdriver=systemd"]

让后重启 docker 服务

systemctl daemon-reload
systemctl restart docker

1.3.2. 方案2: 修改 kubelet 的 cgroup driver

cat  /etc/systemd/system/kubelet.service/10-kubeadm.conf

Environment="...... --cgroup-driver=systemd"

重启 kubelet

systemctl daemon-reload
systemctl restart kubelet

在使用 minikube 安装部署时通过一下命令指定 CgroupDriver

minikube start \
--extra-config=kubelet.cgroup-driver=systemd \
Copyright © 温玉 2021 | 浙ICP备2020032454号 all right reserved,powered by Gitbook该文件修订时间: 2022-01-08 10:04:16

results matching ""

    No results matching ""