![Kubeadm-Kubernetes:无法获取 https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-arm64](https://linux22.com/image/786513/Kubeadm-Kubernetes%EF%BC%9A%E6%97%A0%E6%B3%95%E8%8E%B7%E5%8F%96%20https%3A%2F%2Fpackages.cloud.google.com%2Fapt%2Fdists%2Fkubernetes-xenial%2Fmain%2Fbinary-arm64.png)
我正在尝试在基于 ARM64 的 Ubuntu 20.04 虚拟机上部署 kubernetes(kubeadm 集群)。
部署 kubeadm 时出现以下错误:
xxx@controller01:~$ sudo mkdir -p /etc/apt/keyrings/
xxx@controller01:~$ curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-archive-keyring.gpg
xxx@controller01:~$ echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main
xxx@controller01:~$ sudo apt-get update
Hit:1 http://ae.ports.ubuntu.com/ubuntu-ports focal InRelease
Hit:2 http://ae.ports.ubuntu.com/ubuntu-ports focal-updates InRelease
Hit:3 http://ae.ports.ubuntu.com/ubuntu-ports focal-backports InRelease
Hit:4 http://ae.ports.ubuntu.com/ubuntu-ports focal-security InRelease
Get:5 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [8993 B]
Ign:6 https://packages.cloud.google.com/apt kubernetes-xenial/main arm64 Packages
Ign:6 https://packages.cloud.google.com/apt kubernetes-xenial/main arm64 Packages
Ign:6 https://packages.cloud.google.com/apt kubernetes-xenial/main arm64 Packages
Err:6 https://packages.cloud.google.com/apt kubernetes-xenial/main arm64 Packages
404 Not Found [IP: 142.250.181.110 443]
Fetched 8993 B in 6s (1622 B/s)
Reading package lists... Done
E: Failed to fetch https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-arm64/by-hash/SHA256/51aebd1541ac7598ec1899940eeb94254bffdec2718eec413337389a0d58c794 404 Not Found [IP: 142.250.181.110 443]
E: Some index files failed to download. They have been ignored, or old ones used instead.
当我在 ARM64 架构 CPU 上部署 kubernetes 时,会发生此错误。有什么帮助吗?
[ [UPDATE]
]
我也尝试了添加--dearmor或更改的建议
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-archive-keyring.gpg
到
sudo curl -fsSLo /etc/apt/keyrings/kubernetes-archive-keyring.gpg https://dl.k8s.io/apt/doc/apt-key.gpg
但我遇到了类似的问题:
xxx@controller01:~$ sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl
Hit:1 http://ae.ports.ubuntu.com/ubuntu-ports focal InRelease
Get:2 http://ae.ports.ubuntu.com/ubuntu-ports focal-updates InRelease [114 kB]
Get:3 http://ae.ports.ubuntu.com/ubuntu-ports focal-backports InRelease [108 kB]
Get:4 http://ae.ports.ubuntu.com/ubuntu-ports focal-security InRelease [114 kB]
Get:5 http://ae.ports.ubuntu.com/ubuntu-ports focal-updates/main arm64 Packages [1924 kB]
Get:6 http://ae.ports.ubuntu.com/ubuntu-ports focal-updates/main Translation-en [440 kB]
Get:7 http://ae.ports.ubuntu.com/ubuntu-ports focal-updates/main arm64 c-n-f Metadata [16.5 kB]
Get:8 http://ae.ports.ubuntu.com/ubuntu-ports focal-updates/restricted Translation-en [273 kB]
Get:9 http://ae.ports.ubuntu.com/ubuntu-ports focal-updates/universe arm64 Packages [988 kB]
Get:10 http://ae.ports.ubuntu.com/ubuntu-ports focal-updates/universe Translation-en [254 kB]
Get:11 http://ae.ports.ubuntu.com/ubuntu-ports focal-updates/universe arm64 c-n-f Metadata [23.2 kB]
Get:12 http://ae.ports.ubuntu.com/ubuntu-ports focal-security/main arm64 Packages [1616 kB]
Get:13 http://ae.ports.ubuntu.com/ubuntu-ports focal-security/main Translation-en [358 kB]
Get:14 http://ae.ports.ubuntu.com/ubuntu-ports focal-security/main arm64 c-n-f Metadata [12.7 kB]
Get:15 http://ae.ports.ubuntu.com/ubuntu-ports focal-security/restricted Translation-en [256 kB]
Get:16 http://ae.ports.ubuntu.com/ubuntu-ports focal-security/universe arm64 Packages [759 kB]
Get:17 http://ae.ports.ubuntu.com/ubuntu-ports focal-security/universe Translation-en [173 kB]
Get:18 http://ae.ports.ubuntu.com/ubuntu-ports focal-security/universe arm64 c-n-f Metadata [16.4 kB]
Fetched 7446 kB in 4s (2078 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates is already the newest version (20230311ubuntu0.20.04.1).
ca-certificates set to manually installed.
curl is already the newest version (7.68.0-1ubuntu2.18).
curl set to manually installed.
The following NEW packages will be installed:
apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 122 not upgraded.
Need to get 1704 B of archives.
After this operation, 162 kB of additional disk space will be used.
Get:1 http://ae.ports.ubuntu.com/ubuntu-ports focal-updates/universe arm64 apt-transport-https all 2.0.9 [1704 B]
Fetched 1704 B in 0s (6307 B/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 73286 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_2.0.9_all.deb ...
Unpacking apt-transport-https (2.0.9) ...
Setting up apt-transport-https (2.0.9) ...
xxx@controller01:~$ sudo mkdir -p /etc/apt/keyrings/
xxx@controller01:~$ sudo curl -fsSLo /etc/apt/keyrings/kubernetes-archive-keyring.gpg https://dl.k8s.io/apt/doc/apt-key.gpg
xxx@controller01:~$ sudo echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main
xxx@controller01:~$ sudo apt-get update
Hit:1 http://ae.ports.ubuntu.com/ubuntu-ports focal InRelease
Hit:2 http://ae.ports.ubuntu.com/ubuntu-ports focal-updates InRelease
Hit:4 http://ae.ports.ubuntu.com/ubuntu-ports focal-backports InRelease
Hit:5 http://ae.ports.ubuntu.com/ubuntu-ports focal-security InRelease
Get:3 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [8993 B]
Ign:6 https://packages.cloud.google.com/apt kubernetes-xenial/main arm64 Packages
Ign:6 https://packages.cloud.google.com/apt kubernetes-xenial/main arm64 Packages
Ign:6 https://packages.cloud.google.com/apt kubernetes-xenial/main arm64 Packages
Err:6 https://packages.cloud.google.com/apt kubernetes-xenial/main arm64 Packages
404 Not Found [IP: 142.250.181.110 443]
Fetched 8993 B in 2s (4594 B/s)
Reading package lists... Done
E: Failed to fetch https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-arm64/by-hash/SHA256/51aebd1541ac7598ec1899940eeb94254bffdec2718eec413337389a0d58c794 404 Not Found [IP: 142.250.181.110 443]
E: Some index files failed to download. They have been ignored, or old ones used instead.
答案1
根据 Git 链接,问题发生是因为https://packages.cloud.google.com/apt/doc/apt-key.gpg 返回的 GPG 密钥为 ASCII 封装的,而不是二进制的。如果您执行 gpg --dearmor,则 packages.cloud.google.com apt 中的密钥将再次起作用。
因此,建议一个替代方案 下载包签名密钥的来源。
复制器将在现有安装中运行 apt update,而无需手动更新密钥。
请注意,Kubernetes 帮助页面中的下载位置已发生更改,您可能必须运行 sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg而不是更新密钥文件的位置。
参考此文档由 KASATA 解决此错误。部分索引文件下载失败。它们已被忽略,或使用旧文件代替。