Get list of files inside a running Kubernetes Pod's memory

1/30/2020

Is it possible to get a list files which are occupying a running Pods memory? I have tried metrics-server but that just tells memory and CPU usage per pod and node. Much appreciate any help.

-- Himanshu Kumar
azure
azure-kubernetes
docker
kubernetes

1 Answer

1/31/2020

By assuming what you looking is to list the files inside the container(s) in the pod, you can simply execute kubectl exec command,

List down the pods

kubectl get pods

Get the pod name.

List the filesystem contents,

kubectl exec -it <pod Name> ls

or even,

kubectl exec -it <pod Name> ls <desired path>
-- Anuradha Fernando
Source: StackOverflow