7

I've switched to containerd in a k8s cluster.

There's 2 pods running on one node, 2 github runners.

I used to check on a host what containers were running with "docker container ls" but how to check this when containerd is used?

sudo ctr container ls

comes back with nothing

Serve Laurijssen
  • 552
  • 2
  • 7
  • 15
  • 1
    Try with crictl ps & crictl pods. To be honest, I'm a bit confused between cri-o and containerd as well. Looking at kubespray especially, I would have both options, while setting "containerd" as a runtime, I would still end up using crictl listing/viewing pods, while as you suggest: ctr doesn't show anything. – SYN Oct 26 '22 at 16:11
  • ah yes, crictl does the job. Is that a general name so that it works with any cri? – Serve Laurijssen Oct 27 '22 at 05:17
  • Check your /etc/crictl.yaml: when using containerd, your crictl configuration would just query containerd's socket file – SYN Oct 27 '22 at 06:23

2 Answers2

14

Try to namespace to list command

ctr -n k8s.io containers list

To list available namespaces run

ctr ns ls
fsp
  • 156
  • 2
  • 3
1

I feel relevant and important to note that:

ctr c ls

lists all containers, i.e. either stopped or running.

In accordance with the question title: to precisely list all running containers (in the sense of docker terminology) you need to use this command:

ctr task list

or the shorthand

ctr t ls
adamency
  • 111
  • 1