提示:在centos7的操作系统中使用阿里镜像源安装k8s时报错:repodata/repomd.xml from kubernetes: [Errno 256] No more mirrors to try.

先用了网上的教程,再试了阿里官方的方法(如下)。

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
setenforce 0
yum install -y kubelet kubeadm kubectl
systemctl enable kubelet && systemctl start kubelet


均报同样的错。

failure: repodata/repomd.xml from kubernetes: [Errno 256] No more mirrors to try.
https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: [Errno -1] repomd.xml signature could not be verified for kubernetes
[root@localhost ~]# systemctl enable kubelet && systemctl start kubelet
Failed to execute operation: No such file or directory

详细报错如下:
在这里插入图片描述


解决方案:

提示:修改kubernetes.repo的配置

vim /etc/yum.repo.d/kubernetes.repo

使用下面的内容:

[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg

注意将配置信息中的 gpgcheck 和 repo_gpgcheck 两个字段值,改为 0
再重新安装:

yum install -y kubelet kubeadm kubectl

搞定!

参考链接:
https://blog.csdn.net/weixin_71474937/article/details/125206406

Logo

开源、云原生的融合云平台

更多推荐