Kubernetes K8s 解决 "Failed to run kubelet" err="failed to run Kubelet: running with swap on is not supported, please disable swap!
1、查看日志
journalctl -xeu kubelet | grep Failed
日志内容
12月 28 17:27:02 k8s-node1 kubelet[3442]: E1228 17:27:02.760579 3442 server.go:302] “Failed to run kubelet” err="failed to run Kubelet: running with swap on is not supported, please disable swap! or set --fail-swap-on flag to false. /proc/swaps contained: [Filename\t\t\t\tType\t\tSize\tUsed\tPriority /dev/dm-1
根据报错信息发现,不支持使用swap运行,需要禁用swap,于是修改/etc/sysconfig/kubelet
2、修改/etc/sysconfig/kubelet
vi /etc/sysconfig/kubelet
添加如下配置项
KUBELET_EXTRA_ARGS="--fail-swap-on=false"
3、重置kubeadm
kubeadm reset