大网数据广告活动
服务器运维问答

failed loading custom repository config /etc/yum.repos.d/kubernetes.repo in CentOS 8

· 52CE 我爱测

I am add a custom repository config in CentOS 8 like this in my kvm virtual machine like this: [root@localhost ~]# cat /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=http://mirrors.aliyun.com/kubernetes/yum…

问题原文

原帖链接 · Dolphin · CC BY-SA 4.0

I am add a custom repository config in CentOS 8 like this in my kvm virtual machine like this:

[root@localhost ~]# cat /etc/yum.repos.d/kubernetes.repo 
[kubernetes]
   name=Kubernetes
   baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
   enabled=1
   gpgcheck=0
   repo_gpgcheck=0
   gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
       http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg

but when I using this command to install kuberentes component, it shows me like this:

[root@localhost ~]# yum -y install kubelet kubeadm kubectl
Warning: failed loading '/etc/yum.repos.d/kubernetes.repo', skipping.
Last metadata expiration check: 0:37:38 ago on Sun 05 Jul 2020 08:38:19 AM EDT.
No match for argument: kubelet
No match for argument: kubeadm
No match for argument: kubectl

am I missing something? what should I do to fix this problem?

已采纳解答

原帖链接 · Michael Hampton · CC BY-SA 4.0

I think the problem is that your repo file is not correctly formatted and contains whitespace where there should not be any.

You should re-create the file according to the instructions:

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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-07-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。