When we use kubectl describe pods <pod_name>
, a great deal of information is output, including the node that the server is running on, and miscellaneous information about the pod, including the container IDs and images.
If we ssh into the node, we can poke around /sys/fs/cgroup/memory/kubepods
and find directories such as /sys/fs/cgroup/memory/kubepods/pod6cbf8d09-2a76-11e9-9f3e-42010a80003b
, which have subdirectories that look like hashes. If we examine the processes listed in the cgroup.procs
pseudofile inside these subdirectories, we can infer that these subdirectories correspond to the Docker containers started by Kubernetes.
Unfortunately, a human must manually examine the cgroup.procs
file to infer which container each directory corresponds to.
Is there a way to get names of the subdirectory path under /sys/fs/cgroup/memory/kubepods
which corresponds to a specific container inside a pod?