crictl ps报runtime connect using default endpoints: [unix:///var/run/dockershim.sock unix:///run/containerd/containerd.sock unix:///run/crio/crio.sock unix:///var/run/cri-dockerd.sock].

识趣 发表于: 2022-08-24   最后更新时间: 2022-08-24 19:04:37   249 游览

每次执行

crictl ps

报一个警告,一个错误:

警告是:

WARN[0000] runtime connect using default endpoints: [unix:///var/run/dockershim.sock unix:///run/containerd/containerd.sock unix:///run/crio/crio.sock unix:///var/run/cri-dockerd.sock]. As the default settings are now deprecated, you should set the endpoint instead.

错误是:

ERRO[0000] unable to determine runtime API version: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /var/run/dockershim.sock: connect: no such file or directory"

明细:

WARN[0000] runtime connect using default endpoints: [unix:///var/run/dockershim.sock unix:///run/containerd/containerd.sock unix:///run/crio/crio.sock unix:///var/run/cri-dockerd.sock]. As the default settings are now deprecated, you should set the endpoint instead. 
ERRO[0000] unable to determine runtime API version: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /var/run/dockershim.sock: connect: no such file or directory" 
WARN[0000] image connect using default endpoints: [unix:///var/run/dockershim.sock unix:///run/containerd/containerd.sock unix:///run/crio/crio.sock unix:///var/run/cri-dockerd.sock]. As the default settings are now deprecated, you should set the endpoint instead. 
ERRO[0000] unable to determine image API version: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /var/run/dockershim.sock: connect: no such file or directory" 
CONTAINER           IMAGE               CREATED             STATE               NAME                ATTEMPT             POD ID              POD

请问我该如何解决?

发表于 2022-08-24

crictl依次查找容器运行时,当查找第一个 unix:///var/run/dockershim.sock 没有找到,所以报错了,需要你手动指定当前kubernetes的容器运行时,使用什么,例如:

kubernetes 1.24+ 之后,如果dockershim已经变成了cri-docker,所以你需要执行:

crictl config runtime-endpoint unix:///var/run/cri-dockerd.sock

如果你的容器运行时,已经换成了containerd,则换成containerd的,如:

crictl config runtime-endpoint unix:///var/run/containerd/containerd.sock

之后,你在执行就好了。

另外:生成的配置在cat /etc/crictl.yaml,可以随时修改。

你的答案

查看kubernetes相关的其他问题或提一个您自己的问题
提问