我使用 Containerd 作为容器运行时。当我创建一个 pod 时,包含拉两个图像。(结果来自ctr -n k8s.io i ls -q
)
myprivateregistery/gcr.io/google_containers/kubernetes-dashboard-amd64:v1.7.1 application/vnd.docker.distribution.manifest.v2+json sha256:2cc826b775aacfb15a89a1f2d6685799f360ddb65f101b656097784cef2bb9d7 39.8 MiB linux/amd64 io.cri-containerd.image=managed
myprivateregistery/gcr.io/google_containers/kubernetes-dashboard-amd64@sha256:2cc826b775aacfb15a89a1f2d6685799f360ddb65f101b656097784cef2bb9d7 application/vnd.docker.distribution.manifest.v2+json sha256:2cc826b775aacfb15a89a1f2d6685799f360ddb65f101b656097784cef2bb9d7 39.8 MiB linux/amd64 io.cri-containerd.image=managed
稍后,另一个图像已创建,结果来自ctr -n k8s.io i ls -q
。
myprivateregistery/gcr.io/google_containers/kubernetes-dashboard-amd64:v1.7.1 application/vnd.docker.distribution.manifest.v2+json sha256:2cc826b775aacfb15a89a1f2d6685799f360ddb65f101b656097784cef2bb9d7 39.8 MiB linux/amd64 io.cri-containerd.image=managed
myprivateregistery/gcr.io/google_containers/kubernetes-dashboard-amd64@sha256:2cc826b775aacfb15a89a1f2d6685799f360ddb65f101b656097784cef2bb9d7 application/vnd.docker.distribution.manifest.v2+json sha256:2cc826b775aacfb15a89a1f2d6685799f360ddb65f101b656097784cef2bb9d7 39.8 MiB linux/amd64 io.cri-containerd.image=managed
sha256:294879c6444ed35b8cb94c613e61c47b9938305a1d1eaf452c0d17db471d99e5 application/vnd.docker.distribution.manifest.v2+json sha256:2cc826b775aacfb15a89a1f2d6685799f360ddb65f101b656097784cef2bb9d7 39.8 MiB linux/amd64 io.cri-containerd.image=managed
Containerd 收到的事件:
2021-06-03 10:41:41.942185302 +0000 UTC k8s.io /images/create {"name":"myprivateregistry/gcr.io/google_containers/kubernetes-dashboard-amd64:v1.7.1"}
2021-06-03 10:41:41.944191919 +0000 UTC k8s.io /images/create {"name":"sha256:294879c6444ed35b8cb94c613e61c47b9938305a1d1eaf452c0d17db471d99e5","labels":{"io.cri-containerd.image":"managed"}}
问题是为什么 Containerd 会拉取多个相同的图像。我希望看到一张图片,图片列表命令的输出显示拉取了 3 张图片。此外,如果我创建了很多 pod,它会因此导致磁盘压力。