我尝试在 centos 8 服务器上运行 kubeadm init,但出现此错误
I0609 09:51:54.527931 2575529 version.go:255] remote version is much newer: v1.27.2; falling back to: stable-1.23
[init] Using Kubernetes version: v1.23.17
[preflight] Running pre-flight checks
[WARNING FileExisting-tc]: tc not found in system path
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR FileExisting-conntrack]: conntrack not found in system path
[ERROR DirAvailable--var-lib-etcd]: /var/lib/etcd is not empty
[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
正如错误所说,tc
并且conntrack
缺失,我尝试安装它并出现以下错误。
Centos_8.x_x86_64 0.0 B/s | 0 B 00:00
Errors during downloading metadata for repository 'Centos-8.x':
- Curl error (37): Couldn't read a file:// file for file:///root/os/repodata/repomd.xml [Couldn't open file /root/os/repodata/repomd.xml]
Error: Failed to download metadata for repo 'Centos-8.x': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
答案1
这可能不起作用,因为CentOS Linux 8 已达到 EOL根据官方文章,CentOS Linux 8 官方存储库的内容已从http://mirror.centos.org/到http://vault.centos.org/,它将被永久存档,因为 Centos Linux 8 将无法在 EOL 日期之后提供内容更新。
解决方法 1:參閱Aaron Kili 的文章Tecmint
要修复错误,请打开终端或通过 ssh 登录,然后运行以下命令将 repo URL 更改为指向来自官方 CentOS repos 的 vault.centos.org。
在这里您可以使用 sed 命令来编辑 repo 配置文件中所需的指令或参数:
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
解决方法2:參閱科技一瞥内容由 Ramya Santhosh 撰写。请按照以下步骤解决您的问题:
步骤 1:转到/etc/yum.repos.d/
目录。
[root@autocontroller ~]# cd /etc/yum.repos.d/
第 2 步:运行以下命令
[root@autocontroller ~]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
[root@autocontroller ~]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
步骤 3:现在运行 yum update
[root@autocontroller ~]# yum update -y