简体   繁体   English

使用 containerd 运行 kubernetes 时,我的容器映像在哪里?

[英]Where are my container images when running kubernetes with containerd?

This output says that I'm running kubernetes with containerd as the container runtime:此输出表明我正在运行 kubernetes 并将containerd作为容器运行时:

k get nodes -o wide
NAME          STATUS   ROLES                  AGE   VERSION        INTERNAL-IP    EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION      CONTAINER-RUNTIME
k8s-worker3   Ready    <none>                 12d   v1.24.4+k3s1   10.16.24.123   <none>        Ubuntu 20.04.2 LTS   5.15.0-48-generic   containerd://1.6.6-k3s1
k8s-worker1   Ready    <none>                 12d   v1.24.4+k3s1   10.16.24.121   <none>        Ubuntu 20.04.2 LTS   5.13.0-44-generic   containerd://1.6.6-k3s1
k8s-master    Ready    control-plane,master   12d   v1.24.4+k3s1   10.16.24.120   <none>        Ubuntu 20.04.4 LTS   5.15.0-46-generic   containerd://1.6.6-k3s1
k8s-worker2   Ready    <none>                 12d   v1.24.4+k3s1   10.16.24.122   <none>        Ubuntu 20.04.2 LTS   5.13.0-44-generic   containerd://1.6.6-k3s1

I'm deploying one of my pods, it gets scheduled on node k8s-worker3 , and kubectl describe pods/mypod says the image was already on the node.我正在部署我的一个 pod,它被安排在节点k8s-worker3上,并且kubectl describe pods/mypod说图像已经在节点上。

But when I run ctr on the node it shows that there NO images:但是当我在节点上运行ctr时,它显示没有图像:

user@k8s-worker3:~$ sudo ctr images list
REF TYPE DIGEST SIZE PLATFORMS LABELS

And docker images doesn't show the correct version of the image.并且docker images不显示图像的正确版本。

Here's the processes running containerd:这是运行 containerd 的进程:

user@k8s-worker3:~$ ps -ef | grep container
root         985       1  0 15:23 ?        00:00:00 /usr/bin/containerd
root        1106       1  0 15:23 ?        00:00:01 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root        1312    1057  0 15:23 ?        00:00:12 containerd -c /var/lib/rancher/k3s/agent/etc/containerd/config.toml -a /run/k3s/containerd/containerd.sock --state /run/k3s/containerd --root /var/lib/rancher/k3s/agent/containerd
root        1918       1  0 15:23 ?        00:00:03 /var/lib/rancher/k3s/data/577968fa3d58539cc4265245941b7be688833e6bf5ad7869fa2afe02f15f1cd2/bin/containerd-shim-runc-v2 -namespace k8s.io -id 5abd3c3104abf812422757d9534c33475819cbf43b64845dd23f535193fed09e -address /run/k3s/containerd/containerd.sock
root        1970       1  0 15:23 ?        00:00:00 /var/lib/rancher/k3s/data/577968fa3d58539cc4265245941b7be688833e6bf5ad7869fa2afe02f15f1cd2/bin/containerd-shim-runc-v2 -namespace k8s.io -id 8c339c15ab8abb3050810b5fcaed817363fcf3b06800b554711b1fa0e95006e2 -address /run/k3s/containerd/containerd.sock
root        3231       1  0 15:25 ?        00:00:01 /var/lib/rancher/k3s/data/577968fa3d58539cc4265245941b7be688833e6bf5ad7869fa2afe02f15f1cd2/bin/containerd-shim-runc-v2 -namespace k8s.io -id 354aa1df3c2a8492a4842efe3882785553501d77f61d9b5ef0bf3343ace2a518 -address /run/k3s/containerd/containerd.sock
user      4957    3094  0 15:48 pts/0    00:00:00 grep --color=auto container

So what is happening here?那么这里发生了什么? Where is the image on the node??节点上的图像在哪里?

Try crictl images list as shown below尝试如下所示的crictl 图像列表

在此处输入图像描述

I found this command worked:我发现这个命令有效:

sudo crictl -r unix:///run/k3s/containerd/containerd.sock ps -a

So I needed to specify the Runtime Endpoint (option -r).所以我需要指定运行时端点(选项 -r)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM