版本信息
containerd 2.0.1
runc 1.2.3
cni 1.6.1
镜像加速使用文档
关于镜像加速的使用可以查看以下两个链接
镜像服务提供商-道客
镜像服务提供商-dockerproxy.net
containerd配置说明文档
https://github.com/containerd/containerd/blob/main/docs/hosts.md
配置步骤
k8s中还会涉及到其他镜像仓库,以下仅以docker.io和registry.k8s.io为例子,其他配置类似,具体镜像的加速地址请看此文档https://github.com/DaoCloud/public-image-mirror
k8s中涉及到的仓库有如下
docker.elastic.co
docker.io
gcr.io
ghcr.io
k8s.gcr.io
registry.k8s.io
mcr.microsoft.com
nvcr.io
quay.io
- 创建目录
mkdir -p /etc/containerd/certs.d/docker.io
mkdir -p /etc/containerd/certs.d/registry.k8s.io
- 创建配置文件
touch /etc/containerd/certs.d/docker.io/hosts.toml
touch /etc/containerd/certs.d/registry.k8s.io/hosts.toml
cat>/etc/containerd/certs.d/docker.io/hosts.toml<<EOF
server = "https://docker.io"
[host."https://docker.m.daocloud.io"]
capabilities = ["pull", "resolve"]
[host."https://dockerproxy.com/"]
capabilities = ["pull", "resolve"]
EOF
cat>/etc/containerd/certs.d/registry.k8s.io/hosts.toml<<EOF
server = "registry.k8s.io"
[host."k8s.m.daocloud.io"]
capabilities = ["pull", "resolve"]
EOF
- 重启containerd
systemctl restart containerd.service
- 测试
crictl pull busybox