kubeadm 配置镜像拉取失败

kubeadm 配置镜像拉取失败

我正在尝试使用 containerd 在运行 Ubuntu 20.04 的新机器上安装 k8s,但 kubeadm 无法加载映像:

# kubeadm config images pull --kubernetes-version=1.21.0 --image-repository registry.k8s.io

无法拉取映像“registry.k8s.io/kube-apiserver:v1.21.0”:输出:time="2023-06-14T15:24:34Z" level=fatal msg="验证服务连接:未为端点“unix:///run/containerd/containerd.sock”实现 CRI v1 映像 API:rpc 错误:代码 = 未实现 desc = 未知服务运行时.v1.ImageService",错误:退出状态 1

我检查了 containerd,它正在运行。

# systemctl status containerd
● containerd.service - containerd container runtime
     Loaded: loaded (/lib/systemd/system/containerd.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-06-14 15:21:35 UTC; 9min ago

我没有 /etc/containerd/config.toml 所以它使用默认配置。

插件列表与另一台(更旧的)工作机器完全相同:

# ctr plugins list
TYPE                            ID                       PLATFORMS      STATUS
io.containerd.content.v1        content                  -              ok
io.containerd.snapshotter.v1    aufs                     linux/amd64    ok
io.containerd.snapshotter.v1    btrfs                    linux/amd64    skip
io.containerd.snapshotter.v1    devmapper                linux/amd64    error
io.containerd.snapshotter.v1    native                   linux/amd64    ok
io.containerd.snapshotter.v1    overlayfs                linux/amd64    ok
io.containerd.snapshotter.v1    zfs                      linux/amd64    skip
io.containerd.metadata.v1       bolt                     -              ok
io.containerd.differ.v1         walking                  linux/amd64    ok
io.containerd.gc.v1             scheduler                -              ok
io.containerd.service.v1        introspection-service    -              ok
io.containerd.service.v1        containers-service       -              ok
io.containerd.service.v1        content-service          -              ok
io.containerd.service.v1        diff-service             -              ok
io.containerd.service.v1        images-service           -              ok
io.containerd.service.v1        leases-service           -              ok
io.containerd.service.v1        namespaces-service       -              ok
io.containerd.service.v1        snapshots-service        -              ok
io.containerd.runtime.v1        linux                    linux/amd64    ok
io.containerd.runtime.v2        task                     linux/amd64    ok
io.containerd.monitor.v1        cgroups                  linux/amd64    ok
io.containerd.service.v1        tasks-service            -              ok
io.containerd.internal.v1       restart                  -              ok
io.containerd.grpc.v1           containers               -              ok
io.containerd.grpc.v1           content                  -              ok
io.containerd.grpc.v1           diff                     -              ok
io.containerd.grpc.v1           events                   -              ok
io.containerd.grpc.v1           healthcheck              -              ok
io.containerd.grpc.v1           images                   -              ok
io.containerd.grpc.v1           leases                   -              ok
io.containerd.grpc.v1           namespaces               -              ok
io.containerd.internal.v1       opt                      -              ok
io.containerd.grpc.v1           snapshots                -              ok
io.containerd.grpc.v1           tasks                    -              ok
io.containerd.grpc.v1           version                  -              ok
io.containerd.grpc.v1           cri                      linux/amd64    ok
# dpkg -s kubeadm | grep Version
Version: 1.21.0-00

(kubelet 和 kubectl 相同)

# dpkg -s containerd | grep Version
Version: 1.5.9-0ubuntu1~20.04.6

该版本与集群中已有的其他机器相匹配。

有人有什么想法吗?谢谢。

答案1

这是 Ubuntu 20 提供的旧 containerd 的问题。您可以尝试以下步骤(以 root 身份):

  1. 按照此处所述设置 Docker 存储库文档
  2. 删除旧的 containerd:apt remove containerd
  3. 更新存储库数据并安装新的 containerd:apt update, apt install containerd.io
  4. 删除已安装的默认配置文件:(rm /etc/containerd/config.toml如果存在)
  5. 重启 containerd:systemctl restart containerd

相关内容