在 Amazon Linux 2023 上从 yum repo 安装 kubelet 时出错

在 Amazon Linux 2023 上从 yum repo 安装 kubelet 时出错

我试着大致了解Kubernetes 的艰难之路从头开始安装 Kubernetes。但我在装有 Amazon Linux 2023 的 AWS Graviton (Arm64) 节点上完成了此操作,主要使用 cloud-init。

我安装了列出的大部分依赖项引导 Kubernetes 工作节点来自亚马逊自己的存储库,其中包含 cloud-init 的这一部分。

#cloud-config

packages: ['runc', 'containerd', 'cni-plugins', 'socat', 'conntrack-tools', 'ipset']

但是该存储库不包含 Kubernetes 二进制文件,因此我将官方 Kubernetes Yum 存储库添加到 cloud-init 配置中。

yum_repos:
  kubernetes:
    baseurl: https://pkgs.k8s.io/core:/stable:/v1.28/rpm/
    name: Kubernetes
    gpgcheck: true
    gpgkey: https://pkgs.k8s.io/core:/stable:/v1.28/rpm/repodata/repomd.xml.key
    exclude: kubeadm cri-tools kubernetes-cni

然后,当我登录 VM 实例时,我尝试使用以下命令安装 Kubelet 二进制文件:

sudo dnf install kubelet

但是我收到错误(见下文),它依赖于kubernetes-cni。但是,这是我选择退出的,因为我使用的是cni-plugins来自 Amazon 存储库的二进制文件。据我所知,cni-plugins是 的替代 CNI 实现kubernetes-cni。Kubernetes The Hard Way 也做了同样的选择,使用cni-plugins而不是kubernetes-cni

但是为什么我不能kubelet没有二进制文件就从 repo安装kubernetes-cni二进制文件?这只是 Kubernetes 方面缺少的配置,还是我误解了 Kubernetes The Hard Way 指南中关于工作节点需要哪些二进制文件的内容?

Error:
 Problem: conflicting requests
  - package kubelet-1.28.0-150500.1.1.aarch64 from kubernetes requires kubernetes-cni >= 1.2.0, but none of the providers can be installed
  - package kubelet-1.28.1-150500.1.1.aarch64 from kubernetes requires kubernetes-cni >= 1.2.0, but none of the providers can be installed
  - package kubelet-1.28.2-150500.1.1.aarch64 from kubernetes requires kubernetes-cni >= 1.2.0, but none of the providers can be installed
  - package kubelet-1.28.3-150500.1.1.aarch64 from kubernetes requires kubernetes-cni >= 1.2.0, but none of the providers can be installed
  - package kubelet-1.28.4-150500.1.1.aarch64 from kubernetes requires kubernetes-cni >= 1.2.0, but none of the providers can be installed
  - package kubelet-1.28.5-150500.1.1.aarch64 from kubernetes requires kubernetes-cni >= 1.2.0, but none of the providers can be installed
  - package kubelet-1.28.6-150500.1.1.aarch64 from kubernetes requires kubernetes-cni >= 1.2.0, but none of the providers can be installed
  - package kubelet-1.28.7-150500.1.1.aarch64 from kubernetes requires kubernetes-cni >= 1.2.0, but none of the providers can be installed
  - package kubelet-1.28.8-150500.1.1.aarch64 from kubernetes requires kubernetes-cni >= 1.2.0, but none of the providers can be installed

如果我从cloud-init 中删除kubernetes-cni该部分,并将其作为依赖项进行安装,则会收到冲突错误:exclude:kubeletkubernetes-cni

Error: Transaction test error:
  file /opt/cni/bin/bandwidth from install of kubernetes-cni-1.2.0-150500.2.1.aarch64 conflicts with file from package cni-plugins-1.2.0-1.amzn2023.0.3.aarch64
  file /opt/cni/bin/bridge from install of kubernetes-cni-1.2.0-150500.2.1.aarch64 conflicts with file from package cni-plugins-1.2.0-1.amzn2023.0.3.aarch64
  file /opt/cni/bin/dhcp from install of kubernetes-cni-1.2.0-150500.2.1.aarch64 conflicts with file from package cni-plugins-1.2.0-1.amzn2023.0.3.aarch64
  file /opt/cni/bin/dummy from install of kubernetes-cni-1.2.0-150500.2.1.aarch64 conflicts with file from package cni-plugins-1.2.0-1.amzn2023.0.3.aarch64
  file /opt/cni/bin/firewall from install of kubernetes-cni-1.2.0-150500.2.1.aarch64 conflicts with file from package cni-plugins-1.2.0-1.amzn2023.0.3.aarch64

相关内容