containerd 1.4.9 未实现 desc = 未知服务运行时.v1alpha2.RuntimeService

containerd 1.4.9 未实现 desc = 未知服务运行时.v1alpha2.RuntimeService

我已经containerd 1.4.9在 CentOS steam 8 服务器上安装。

基于此文档https://containerd.io/docs/getting-started/containerd config default > /etc/containerd/config.toml。我已经创建了像这样的默认配置文件。

重新启动 containerd 后,当我运行crictl ps它时会抛出以下错误

FATA[0000] listing containers failed: rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService

如何修复此错误?修复此错误后,我想1.21.3使用systemdcfgroup 将此节点加入 Kubernets 集群。

谢谢 SR

答案1

今天在工作节点上升级 kubelet 时遇到了同样的错误。问题出在默认配置中。请注意,containerd 无需任何配置即可正常运行。就我而言,我只想启用 systemd_cgroup。

ctr plugin ls显示 cri 插件在默认配置下处于错误状态

对于我来说,只需一个带有 systemd_cgroup 修复问题的空白配置即可:

cat > /etc/containerd/config.toml <<EOF
[plugins."io.containerd.grpc.v1.cri"]
  systemd_cgroup = true
EOF
systemctl restart containerd

答案2

背景上下文关于错误:
gitlab.cncf.ci/containerd crictl.md 文档

“这可能是因为您使用了错误的容器配置(可能是来自 Docker 安装)。您需要将容器配置更新为您正在运行的容器实例。”

  • 我自己安装了 docker,然后 yum 安装了 crictl 来研究命令语法差异并遇到了这个问题。
  • 链接文档中发布的解析命令只有以 root 身份运行时才有效,因此这里有一个更通用的版本。
# Backup old containerd config (optional)
sudo mv /etc/containerd/config.toml /etc/containerd/config.bak

# Regenerate containerd config
sudo containerd config default | sudo tee /etc/containerd/config.toml

# Restart containerd
sudo systemctl restart containerd

# The above got it to work for me; but with some warnings 
# and ignorable errors that looked this this: 
sudo crictl ps
# WARN[0000] runtime connect using default endpoints: [unix:///var/run/dockershim.sock unix:///run/containerd/containerd.sock unix:///run/crio/crio.sock]. As the default settings are now deprecated, you should set the endpoint instead.
# ERRO[0002] connect endpoint 'unix:///var/run/dockershim.sock', make sure you are running as root and the endpoint has been started: context deadline exceeded
# WARN[0002] image connect using default endpoints: [unix:///var/run/dockershim.sock unix:///run/containerd/containerd.sock unix:///run/crio/crio.sock]. As the default settings are now deprecated, you should set the endpoint instead.
# ERRO[0004] connect endpoint 'unix:///var/run/dockershim.sock', make sure you are running as root and the endpoint has been started: context deadline exceeded
# CONTAINER           IMAGE               CREATED             STATE               NAME                ATTEMPT             POD ID
# ^-- The last line represents correct output, which is why 
# I say ignorable warnings/errors, even the post command 
# exit code seeable using 'echo $?' exit code shows success

# What cleaned up the errors for me was copy pasting the following
echo """
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
""" | sudo tee /etc/crictl.yaml

docker ps
# ^-- no more errors :)

# Note others may need to run one of these instead, based on their
# system's config, keep trying docker ps until one config works
echo """
runtime-endpoint: unix:///var/run/crio/crio.sock
image-endpoint: unix:///var/run/crio/crio.sock
""" | sudo tee /etc/crictl.yaml

echo """
runtime-endpoint: unix:///var/run/dockershim.sock
image-endpoint: unix:///var/run/dockershim.sock
""" | sudo tee /etc/crictl.yaml

答案3

此问题与 CRI 插件中的错误有关。您可以检查 CRI 插件的状态

ctr plugin ls

过去我由于 devmapper 问题遇到过同样的问题,由于 devmapper 配置为默认 CRI 快照程序,因此 CRI 也出现错误。

TYPE                                  ID                       PLATFORMS      STATUS
io.containerd.snapshotter.v1          devmapper                linux/amd64    error
io.containerd.grpc.v1                 cri                      linux/amd64    error

我重新配置 devmapper 快照程序后问题消失。

删除配置(/etc/containerd/config.toml)也有效,但是 containerd 使用默认配置运行,这不是我想要的。

答案4

就我而言,要设置的 containerd 的正确参数不是,systemd_cgroup而是:

[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
            #[...]
            SystemdCgroup = true

哪个配置文件中的不同设置。

这是官方 Kubernetes 文档建议设置为 true 的实际设置:https://kubernetes.io/docs/setup/production-environment/container-runtimes/#containerd-systemd

相关内容