如何解决执行crictl命令报错的问题

容器与中间件容器服务技术服务知识库
问题描述

安装了 containerd 启动容器,执行 crictl 命令是报错,提示如下信息:

WARN[0000] 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[0002] connect endpoint 'unix:///var/run/dockershim.sock', make sure you are running as root and the endpoint has been started: context deadline exceeded
问题分析

crictl执行命令时默认会去 /var/run/dockershim.sock 找 sock 文件,如果没有这个文件,则会提示报错。

问题解决

1.创建 crictl 配置文件

cat /etc/crictl.yaml 
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
timeout: 5
debug: false

2.执行命令测试

crictl images list
参考链接

https://github.com/kubernetes-sigs/cri-tools/blob/master/docs/crictl.md https://kubernetes.io/zh/docs/tasks/debug-application-cluster/crictl/

0
0
0
0
评论
未登录
看完啦,登录分享一下感受吧~
暂无评论