故障error: failed to run Kubelet: failed to create kubelet: misconfiguration: kubelet cgroup driver: “
環(huán)境:
? ? docker:18.09.9
? ? kubernetes:1.17
錯(cuò)誤信息:
error: failed to run Kubelet: failed to create kubelet: misconfiguration:?kubelet cgroup driver: "cgroupfs" is different from docker cgroup driver: "systemd"?
錯(cuò)誤原因:
? ? docker和k8s使用的cgroup不一致導(dǎo)致
解決辦法:
? ? 修改二者一致,統(tǒng)一使用systemd或者cgroupfs進(jìn)行資源管理。由于k8s官方文檔中提示使用cgroupfs管理docker和k8s資源,而使用systemd管理節(jié)點(diǎn)上其他進(jìn)程資源在資源壓力大時(shí)會(huì)出現(xiàn)不穩(wěn)定,因此推薦修改docker和k8s統(tǒng)一使用systemd管理資源。
Cgroup drivers
When systemd is chosen as the init system for a Linux distribution, the init process generates and consumes a root control group (cgroup) and acts as a cgroup manager. Systemd has a tight integration with cgroups and will allocate cgroups per process. It’s possible to configure your container runtime and the kubelet to use?cgroupfs. Using?cgroupfs?alongside systemd means that there will then be two different cgroup managers.
Control groups are used to constrain resources that are allocated to processes. A single cgroup manager will simplify the view of what resources are being allocated and will by default have a more consistent view of the available and in-use resources. When we have two managers we end up with two views of those resources. We have seen cases in the field where nodes that are configured to use?cgroupfs?for the kubelet and Docker, and?systemd?for the rest of the processes running on the node becomes unstable under resource pressure.
docker修改方法:
? ? 在
cat > /etc/docker/daemon.json <<EOF {"exec-opts": ["native.cgroupdriver=systemd"]} EOF重啟docker: systemctl restart dockerk8s修改方法:? ??
在 Master 節(jié)點(diǎn)上配置 kubelet 所需的 cgroup 驅(qū)動(dòng)
使用 Docker 時(shí),kubeadm 會(huì)自動(dòng)為其檢測(cè) cgroup 驅(qū)動(dòng)在運(yùn)行時(shí)對(duì)?/var/lib/kubelet/kubeadm-flags.env?文件進(jìn)行配置。 如果您使用了不同的 CRI, 您得把?/etc/default/kubelet?文件中的?cgroup-driver?位置改為對(duì)應(yīng)的值,像這樣:
KUBELET_EXTRA_ARGS=--cgroup-driver=<value>這個(gè)文件將會(huì)被?kubeadm init?和?kubeadm join?用于為 kubelet 獲取 額外的用戶參數(shù)。
需要重啟 kubelet:
systemctl daemon-reloadsystemctl restart kubelet總結(jié)
以上是生活随笔為你收集整理的故障error: failed to run Kubelet: failed to create kubelet: misconfiguration: kubelet cgroup driver: “的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Mybatis(1)---入门篇单表查询
- 下一篇: Jquery 获取select选中的va