https://rancher.com/ logo
Title
s

square-coat-44873

12/21/2022, 4:21 PM
hi, i installed k3s with 1 server and 3 agent nodes. i noticed k3s is using containerd by default. how do i list the containers running on any given node (server or agents)? I had posted this same question on stackoverflow but not getting anywhere: https://stackoverflow.com/questions/73941545/where-are-my-container-images-when-running-kubernetes-with-containerd
When i used to run k8s runs with docker, I would be able to do things like
docker ps
and
docker logs
, … to see which containers were launched by k8s, view container logs, etc.. . so i how do i do the same with containerd?
i

icy-finland-84263

12/21/2022, 4:36 PM
I’m not sure if this will work for you or not, but I’ve used
crictl image ls
on k3os in the past to list the images that a certain node has
s

square-coat-44873

12/21/2022, 4:37 PM
$ crictl image ls
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.
ERRO[0000] unable to determine image API version: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /var/run/dockershim.sock: connect: no such file or directory"
ERRO[0000] unable to determine image API version: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /run/containerd/containerd.sock: connect: permission denied"
ERRO[0000] unable to determine image API version: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /run/crio/crio.sock: connect: no such file or directory"
ERRO[0000] unable to determine image API version: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /var/run/cri-dockerd.sock: connect: no such file or directory"
FATA[0000] unable to determine image API version: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /var/run/cri-dockerd.sock: connect: no such file or directory"
i also get similar errors if i run this with
sudo
$ sudo crictl image ls
[sudo] password for jacohn:
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.
ERRO[0000] unable to determine image API version: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /var/run/dockershim.sock: connect: no such file or directory"
E1221 09:37:05.219388  419091 remote_image.go:125] "ListImages with filter from image service failed" err="rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.ImageService" filter="&ImageFilter{Image:&ImageSpec{Image:ls,Annotations:map[string]string{},},}"
FATA[0000] listing images: rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.ImageService
i

icy-finland-84263

12/21/2022, 4:40 PM
Sorry, I’m not sure. The command I used was on k3os which may implement the container runtime differently
s

square-coat-44873

12/21/2022, 4:41 PM
ok, well thx for responding at least!
g

gray-lawyer-73831

12/21/2022, 5:21 PM
sudo crictl -r unix:///run/k3s/containerd/containerd.sock ps -a
s

square-coat-44873

12/21/2022, 6:17 PM
oh wow, that worked! thx!