提示问题:
[kubelet-check] It seems like the kubelet isn’t running or healthy.
[kubelet-check] The HTTP call equal to ‘curl -sSL http://localhost:10248/healthz’ failed with error: Get http://localhost:10248/healthz: dial tcp 127.0.0.1:10248: connect: connection refused.
这是cgroup驱动问题。默认情况下Kubernetes cgroup驱动程序设置为system,但docker设置为systemd。我们需要更改Docker cgroup驱动,通过创建配置文件/etc/docker/daemon.json并添加以下行:
{“exec-opts”: [“native.cgroupdriver=systemd”]}
为使配置生效,你必须重启docker和kubelet。
systemctl daemon-reload
systemctl restart docker
systemctl restart kubelet
现在,我们尝试重新初始化一个Kubernetes集群,通过运行以下命令。
kubeadm reset
kubeadm init --config=init.default.yaml
如果还是报错, 查看主节点是否内存有交换区:free -m
关闭内存交换区swapoff -a
systemctl restart kubelet
kubeadm reset
kubeadm init --config=init.default.yaml