Kubernetes 的 RPM 不再存在于 https://packages.cloud.google.com/

RPMs for Kubernetes do not exist anymore on https://packages.cloud.google.com/

跟随 Kubernetes installation guide I found than all the RPMS were removed from the YUM repository https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/Packages. However, on the release notes page you can see the links to binaries but not RPMs (for example: https://dl.k8s.io/v1.18.0/kubernetes-server-linux-amd64.tar.gz).

谁能指出 RPM 的位置?我知道 Fedora 带有他们自己的 RPMS,但与网站提供的相比,这些更旧(例如,Fedora 29 提供 1.10,而网站提供 1.18)。

提前致谢。

--何塞

它们并没有消失,只是在网络浏览器中不可见(我不知道为什么)。如果您遵循 instructions 将 yum 存储库添加到您的系统,您将能够从该存储库安装 RPM。虽然没有kubernetes server相关的rpm。

$cat /etc/yum.repos.d/kubernetes.repo 
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=0
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

$dnf list --disablerepo='*' --enablerepo=kubernetes --available 
Last metadata expiration check: 0:06:26 ago on Mon 13 Jul 2020 21:24:45 CEST.
Available Packages
cri-tools.x86_64                                                                                1.13.0-0                                                                            kubernetes
kubeadm.x86_64                                                                                  1.18.5-0                                                                            kubernetes
kubelet.x86_64                                                                                  1.18.5-0                                                                            kubernetes
kubernetes-cni.x86_64                                                                           0.8.6-0                                                                             kubernetes
rkt.x86_64                                                                                      1.27.0-1                                                                            kubernetes

为了完整性,我决定post如何使用 DNF 获取 RPMS:

sudo  dnf install kubelet kubeadm kubectl --disableexcludes=kubernetes -v --downloaddir=/tmp/k8s --downloadonly

Dependencies resolved.
Excludes in repo kubernetes: kubeadm, kubectl, kubelet
===========================================================================================================================================================================================================
 Package                                                   Arch                                      Version                                           Repository                                     Size
===========================================================================================================================================================================================================
Installing:
 kubeadm                                                   x86_64                                    1.19.2-0                                          kubernetes                                    8.3 M
 kubectl                                                   x86_64                                    1.19.2-0                                          kubernetes                                    9.0 M
 kubelet                                                   x86_64                                    1.19.2-0                                          kubernetes                                     19 M
Installing dependencies:
 cri-tools                                                 x86_64                                    1.13.0-0                                          kubernetes                                    5.1 M
 kubernetes-cni                                            x86_64                                    0.8.7-0                                           kubernetes                                     19 M
 conntrack-tools                                           x86_64                                    1.4.4-8.fc29                                      strike-os                                     200 k
 ebtables                                                  x86_64                                    2.0.10-28.fc29                                    strike-os                                     132 k
 libnetfilter_cthelper                                     x86_64                                    1.0.0-14.fc29                                     strike-os                                      22 k
 libnetfilter_cttimeout                                    x86_64                                    1.0.0-12.fc29                                     strike-os                                      22 k
 libnetfilter_queue                                        x86_64                                    1.0.2-12.fc29                                     strike-os                                      26 k

Transaction Summary
===========================================================================================================================================================================================================
Install  10 Packages

Total size: 61 M
Installed size: 261 M
DNF will only download packages for the transaction.
Is this ok [y/N]:

rpms 将在 /tmp/k8s

等你

谢谢,我在 CentOS 8.2 上完成了此操作,但不得不进行一些调整。 在这个文件中

/etc/yum.repos.d/kubernetes.repo

我更改了这一行以启用它,所以我将其更改为:

enabled=0

至:

enabled=1

所以我的 /etc/yum.repos.d/kubernetes.repo 文件看起来像:

[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
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

然后我能够做到(对于 CentOS 8.x 或 Red Hat 8.x 你可以使用 dnf 而不是 yum,实际命令是 dnf 但是在 8.x 他们做了某种别名来指向 yumdnf)

mkdir /tmp/k8s
yum -y install --downloadonly --downloaddir=/tmp/k8s kubeadm kubelet kubectl

这下载了 3 个 rpms 和依赖项。所以我的输出是

14bfe6e75a9efc8eca3f638eb22c7e2ce759c67f95b43b16fae4ebabde1549f3-cri-tools-1.13.0-0.x86_64.rpm
b1b077555664655ba01b2c68d13239eaf9db1025287d0d9ccaeb4a8850c7a9b7-kubectl-1.19.2-0.x86_64.rpm
conntrack-tools-1.4.4-10.el8.x86_64.rpm
d0ba40edfc0fdf3aeec3dd8e56c01ff0d3a511cc0012aabce55d9a83d9bf2b69-kubeadm-1.19.2-0.x86_64.rpm
d9d997cdbfd6562824eb7786abbc7f4c6a6825662d0f451793aa5ab8c4a85c96-kubelet-1.19.2-0.x86_64.rpm
db7cb5cb0b3f6875f54d10f02e625573988e3e91fd4fc5eef0b1876bb18604ad-kubernetes-cni-0.8.7-0.x86_64.rpm
libnetfilter_cthelper-1.0.0-15.el8.x86_64.rpm
libnetfilter_cttimeout-1.0.0-11.el8.x86_64.rpm
libnetfilter_queue-1.0.2-11.el8.x86_64.rpm
socat-1.7.3.3-2.el8.x86_64.rpm

另一种方法,我也做了以下

yum install -y yum-utils

然后 运行 这 3 个命令

yumdownloader kubeadm
yumdownloader kubelet
yumdownloader kubectl

这让我得到了当前目录中的这 3 个文件,您 运行 命令来自

-rw-r--r-- 1 root root  9450186 Oct  8 10:11 b1b077555664655ba01b2c68d13239eaf9db1025287d0d9ccaeb4a8850c7a9b7-kubectl-1.19.2-0.x86_64.rpm
-rw-r--r-- 1 root root  8725678 Oct  8 10:10 d0ba40edfc0fdf3aeec3dd8e56c01ff0d3a511cc0012aabce55d9a83d9bf2b69-kubeadm-1.19.2-0.x86_64.rpm
-rw-r--r-- 1 root root 20438926 Oct  8 10:11 d9d997cdbfd6562824eb7786abbc7f4c6a6825662d0f451793aa5ab8c4a85c96-kubelet-1.19.2-0.x86_64.rpm

仅供下载特定版本的 kubectl 运行 此命令

yum --showduplicates list kubectl

这将在第 2 列中显示所有可用的版本。下载特定版本的语法是:

yumdownloader <packagename>-<version number>.x86_64

例如,为 x86_64 平台下载 kubectl 版本 1.18.9.0 运行

yumdownloader kubectl-1.18.9-0.x86_64

请参阅此处了解如何下载特定版本的软件包 https://www.thegeekdiary.com/centos-rhel-how-to-install-a-specific-version-of-rpm-package-using-yum