crictl
#
- crictl 是 CRI 兼容的容器运行时命令行接口,用来检查和调试 Kubernetes 节点上的容器运行时和应用程序
- crictl 不支持改镜像 tag
- crictl 不支持 load 镜像文件
- 需要用 ctr
```shell
# namespace 为 k8s.io
ctr -n=k8s.io image pull registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.6
ctr -n=k8s.io image tag registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.6 registry.k8s.io/pause:3.6
```
参考:
- [Crictl not support load images?](https://github.com/kubernetes-sigs/cri-tools/issues/546)
- [Manually Loading Container Images with containerD](https://blog.scottlowe.org/2020/01/25/manually-loading-container-images-with-containerd/)
安装
#
VERSION="v1.26.0"
wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz
sudo tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin
# rm -f crictl-$VERSION-linux-amd64.tar.gz
# 默认是使用 docker
# 配置使用 containerd
cat << EOF > /etc/crictl.yaml
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
timeout: 10
EOF
使用
#
crictl image ls
crictl ps -a
叶王 © 2013-2024 版权所有。如果本文档对你有所帮助,可以请作者喝饮料。