How-To Query Container Mounts Using Crictl or Nerdctl

Problem

You want to list the mounts from each container without needing to exec into the container.

Environment

  • Platform9 Managed Kubernetes - All Versions

  • Containerd

Procedure

  1. List the containers running on the node using the crictl or nerdctl utility pre-installed on the node.

# /opt/pf9/pf9-kube/bin/crictl -r unix:///run/containerd/containerd.sock ps
CONTAINER           IMAGE               CREATED             STATE               NAME                      ATTEMPT             POD ID
68484121d71d1       0e9462c49c897       22 hours ago        Running             pf9-addon-operator        0                   31ce653d2a519
.........

# /opt/pf9/pf9-kube/bin/nerdctl -n k8s.io ps -a
CONTAINER ID    IMAGE                                                      COMMAND                   CREATED         STATUS     PORTS    NAMES
62d00aca415d    gcr.io/etcd-development/etcd:v3.4.14                       "/usr/local/bin/etcd"     25 hours ago    Up                  etcd
.......
  1. Find the PID of the container

  1. Query the /proc filesystem to find the mount information for each container.

Last updated