解决使用 cri-o 时的 kubeadm init 失败问题

79次阅读
没有评论

问题描述

在使用 kubeadm init 命令初始化 Kubernetes 集群时,出现了一些问题。具体地,执行 kubeadm init 过程中出现了如下错误信息:

[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.
Unfortunately, an error has occurred:
timed out waiting for the condition
This error is likely caused by:
- The kubelet is not running
- The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)

If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
- 'systemctl status kubelet'
- 'journalctl -xeu kubelet'

Additionally, a control plane component may have crashed or exited when started by the container runtime. 
To troubleshoot, list all containers using your preferred container runtime's CLI, e.g. docker.

你尝试了一些方法,但仍然无法解决问题。你的配置和环境如下:

  • CentOS Linux release 7.7.1908 (Core)
  • Cri-O 版本: 1.15.1-2.el7
  • kubelet 版本: v1.17.2

你在 /etc/sysconfig/kubelet 中尝试了以下配置:

KUBELET_ARGS="--container-runtime=remote  --container-runtime-endpoint=unix:///var/run/crio/crio.sock --runtime-request-timeout=10m --cluster_domain=topota.madre"

你还尝试了将 cgroup manager 设置为 systemd,并设置了一些其他参数,但问题仍然存在。

解决方案

根据你的配置和问题描述,问题可能与 Cri-O 和 Kubernetes 版本之间的兼容性有关。为了解决这个问题,你需要确保 Cri-O 和 Kubernetes 版本匹配。

crictl version 输出可以看出,你当前使用的 Cri-O 版本为 1.15.1-2.el7。根据 Cri-O 的兼容性矩阵,你需要使用与 Kubernetes 版本匹配的 Cri-O 版本。而在你的情况下,Kubernetes 版本是 v1.17.2。

解决方法如下:

  1. 升级 Cri-O 版本: 为了与 Kubernetes 版本匹配,你可以尝试升级 Cri-O 到与 Kubernetes v1.17.2 兼容的版本。你可以尝试从源代码编译 Cri-O,或者查看是否有适用于 CentOS 7.7 的适当版本。

  2. 降低 Kubernetes 版本: 如果无法升级 Cri-O 或者你不想升级,你可以尝试将 Kubernetes 版本降低到与 Cri-O 1.15.1-2.el7 兼容的版本。这将确保 Kubernetes 和 Cri-O 之间的版本一致性。

无论你选择哪种方法,都需要确保 Kubernetes 和 Cri-O 版本匹配,以避免兼容性问题。此外,如果你决定升级 Cri-O,请确保遵循适当的安装和配置步骤。

希望这些解决方案能够帮助你解决问题。如果你遇到任何其他问题,请随时咨询。

正文完