使用crictl 客户端时报错: As the default settings are now deprecated, you should set the endpoint instead.

完整报错如下:

[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
    
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值