完整报错如下:
[root@k8s-master ~]# crictl images
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.
E0416 14:17:48.219277 19714 remote_image.go:119] "ListImages with filter from image service failed" err="rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial unix /var/run/dockershim.sock: connect: no such file or directory\"" filter="&ImageFilter{Image:&ImageSpec{Image:,Annotations:map[string]string{},},}"
FATA[0000] listing images: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /var/run/dockershim.sock: connect: no such file or directory"
报错大致意思: 默认的容器端点 sock文件已经被弃用,所有你需要自己选择sock文件。
官网手册: https://github.com/kubernetes-sigs/cri-tools/blob/master/docs/crictl.md
端点可以通过三种方式设置:
-
通过设置全局选项标志–runtime-endpoint( -r) 和–image-endpoint( -i)
例如我使用containerd容器运行时,sock文件位置 /run/containerd/containerd.sock[root@k8s-master ~]# crictl -r unix:///run/containerd/containerd.sock images IMAGE TAG IMAGE ID SIZE registry.aliyuncs.com/google_containers/coredns v1.10.1 ead0a4a53df89 16.2MB registry.aliyuncs.com/google_containers/etcd 3.5.9-0 73deb9a3f7025 103MB registry.aliyuncs.com/google_containers/kube-apiserver v1.28.0 bb5e0dde9054c 34.6MB registry.aliyuncs.com/google_containers/kube-controller-manager v1.28.0 4be79c38a4bab 33.4MB registry.aliyuncs.com/google_containers/kube-proxy v1.28.0 ea1030da44aa1 24.6MB registry.aliyuncs.com/google_containers/kube-scheduler v1.28.0 f6f496300a2ae 18.8MB registry.aliyuncs.com/google_containers/pause 3.9 e6f1816883972 322kB -
通过设置环境变量CONTAINER_RUNTIME_ENDPOINT和IMAGE_SERVICE_ENDPOINT
export CONTAINER_RUNTIME_ENDPOINT=unix:///run/containerd/containerd.sock export IMAGE_SERVICE_ENDPOINT=unix:///run/containerd/containerd.sock -
通过在配置文件中设置端点–config=/etc/crictl.yaml (默认读取/etc/crictl.yaml配置文件,文件不存在则创建)
cat /etc/crictl.yaml runtime-endpoint: unix:///run/containerd/containerd.sock image-endpoint: unix:///run/containerd/containerd.sock timeout: 2 debug: true pull-image-on-create: false

408

被折叠的 条评论
为什么被折叠?



