我正在阅读 kebernetes 安装文档(https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/),现在我应该安装kubelet
、kubeadm
和kubectl
RPM。我创建了这个 yum 仓库:
[root@stg-003 ~]# cat /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kubelet kubeadm kubectl
然后我执行这个 yum 命令:
[root@stg-003 ~]# yum install -y kubelet kubeadm kubectl –disableexcludes=kubernetes
输出结果如下:
Loaded plugins: fastestmirror, langpacks, merge-conf, priorities, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
13024 packages excluded due to repository priority protections
No package kubelet available.
No package kubeadm available.
No package kubectl available.
Error: Nothing to do
我去过这里https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/Packages沒有包裹!
那么我该如何安装和kubelet
RPM ?kubeadm
kubectl
答案1
你被复制粘贴的不幸混合所困扰,而且yum
显然将 unicode 字符视为包名称的一部分:
print(repr("[root@stg-003 ~]# yum install -y kubelet kubeadm kubectl –disableexcludes=kubernetes".encode("utf-8")))
>>> b'[root@stg-003 ~]# yum install -y kubelet kubeadm kubectl \xe2\x80\x93disableexcludes=kubernetes'
将其切换到双破折号语法可以按预期安装(至少在 上centos:7
):
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
更新:我去为他们的网站开了一个 PR,但看起来工作已经在进行了中:https://github.com/kubernetes/website/issues/20915