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?


I would not suggest renaming the container subdirectories as the containers within them hashes. If you rename these subdirectories, it could in fact break the file-system.

Also, /sys holds information and configurations that the kernel provides. Changing any information or configurations within this directory can lead to unintended behavior within the node.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.