Where we can see the mounted directory on host when "emptyDir" volume with "medium: Memory" is used in kubernetes?

10/1/2019

I used volume with these configuration in kubernetes:

emptyDir:
  medium: Memory

How to dynamically/programatically figure out the host path on the nodes?

-- SOWMITHRA KUMAR G M
kubernetes
kubernetes-helm

1 Answer

10/1/2019

Basing on the official documentation:

By default, emptyDir volumes are stored on whatever medium is backing the node - that might be disk or SSD or network storage, depending on your environment. However, you can set the emptyDir.medium field to "Memory" to tell Kubernetes to mount a tmpfs (RAM-backed filesystem) for you instead. While tmpfs is very fast, be aware that unlike disks, tmpfs is cleared on node reboot and any files you write will count against your Container’s memory limit.

If I understand you correctly (and by host path you doesn't mean hostPath) you can simply execute # df -h which will display how much disk space is available in a human readable form. Also showing:

  • Filesystem (in your case tmpfs)
  • Size
  • Used
  • Available
  • Use%
  • Mounted on

It's worth noting that the default size of a RAM-based emptyDir is half the RAM of the node it runs on.

Please let me know if that helps.

-- OhHiMark
Source: StackOverflow