Kubeadm 初始化问题

Vee*_*vva 2 kubernetes kubectl

Kubeadm 初始化问题。

配置数据版本:

os -rhel7.5
env -onprem server
docker - 19
kube - 18
Run Code Online (Sandbox Code Playgroud)

控制台输出:

[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[kubelet-check] Initial timeout of 40s passed.
[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 [::1]:10248: connect: connection refused.
[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 [::1]:10248: connect: connection refused.
[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 [::1]:10248: connect: connection refused.
[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 [::1]:10248: connect: connection refused.
Run Code Online (Sandbox Code Playgroud)

出了什么问题以及如何解决?

aci*_*uji 5

根据您提供的信息,可以在此处执行几项操作。

首先可以检查docker原生的cgroupdriver和kubelet是否一致。您可以通过运行以下命令查看 kubelet 的配置:

cat /var/lib/kubelet/kubeadm-flags.env 
Run Code Online (Sandbox Code Playgroud)

要检查 docker 配置,您可以简单地使用:

docker info | grep Cgroup
Run Code Online (Sandbox Code Playgroud)

如果你需要改变它,你可以这样做:

cat << EOF > /etc/docker/daemon.json
{
  "exec-opts": ["native.cgroupdriver=systemd"]
}
EOF
Run Code Online (Sandbox Code Playgroud)

要更改 kubelet cgroup 驱动程序,您必须:

`vi /etc/systemd/system/kubelet.service.d/10-kubeadm.conf`
Run Code Online (Sandbox Code Playgroud)

并更新 KUBELET_CGROUP_ARGS=--cgroup-driver=<systemd or cgroupfs>

第二种可能的解决方案是禁用交换。您可以使用以下命令来做到这一点:

sudo swapoff -a
sudo sed -i '/ swap / s/^/#/' /etc/fstab
Run Code Online (Sandbox Code Playgroud)

之后重新启动机器,然后执行kubeadm reset并尝试使用 初始化集群kubeadm init