k8s启动异常detected “cgroupfs” as the Docker cgroup driver

异常信息

W0221 11:46:42.605350    5475 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]
[init] Using Kubernetes version: v1.18.0
[preflight] Running pre-flight checks
	[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/
error execution phase preflight: [preflight] Some fatal errors occurred:
	[ERROR Swap]: running with swap on is not supported. Please disable swap
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher

分析原因

  • 检测到“cgroupfs”作为Docker cgroup驱动程序。推荐的驱动程序是“systemd”

解决方法

  • 更换docker驱动
vim /etc/docker/daemon.json

{
    "registry-mirrors": ["https://s8mlp363.mirror.aliyuncs.com"],
    "exec-opts":["native.cgroupdriver=systemd"]
}

systemctl daemon-reload && systemctl restart docker
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐