我正在尝试使用 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="validate service connection: CRI v1 image API is未为端点“unix:///run/containerd/containerd.sock”实现:rpc 错误:code = Unimplemented desc = unknown service runtime.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
这些版本与集群中已有的其他机器相匹配。
有人有主意吗?谢谢。
这是 Ubuntu 20 提供的旧 containerd 的问题。您可以尝试以下步骤(以 root 身份):
apt remove containerd
apt update, apt install containerd.io
rm /etc/containerd/config.toml
如果存在)systemctl restart containerd