How to find out where kubelet is creating the emptyDirs?

8/28/2019

I know where the location is by default which is under /var/lib/kubelet

However I don't want to depend on this knowledge. I'd like to get the location using command line or checking some config file (which hopefully is stored in a more permanent location).

Is there a way to determine where the location is? if indeed changed by the user?

-- Jeff Saremi
kubelet
kubernetes

1 Answer

8/28/2019

So it depends how the root-dir parameter was applied to the kubelet:

F.e you should see this in systemctl status kubelet.

Another approach is to search for KubeletRootDir journalctl -u kubelet | grep KubeletRootDir

So please use this approach -root-dir by default = /var/lib/kubelet/

sudo ls -l /root-dir/`kubectl get pod -n mynamespace mypod -o 'jsonpath={.metadata.uid}'`/volumes/kubernetes.io~empty-dir/monted_volume

Hope this help.

-- Hanx
Source: StackOverflow