4

If I have a buggy app in a container that is constantly writing to an emptyDir volume it could use up all the space on the worker node and affect the performance of other pods / containers on the node. Thus breaking the expectation that containers are isolated from each other what one container does should not negatively impact other containers on the node.

Is there a way to limit the amount of disk space used by a emptyDir volume (not the RAM based emptyDir type)?

mohan08p
  • 5,002
  • 1
  • 28
  • 36
ams
  • 60,316
  • 68
  • 200
  • 288

1 Answers1

6

You can set sizeLimit on the volume (see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#emptydirvolumesource-v1-core). Setting this will, once the volume is full, evict the pod.

imsky
  • 3,239
  • 17
  • 16
  • Is there a way in the app running inside the container to check how much data the container / application is using out of the sizeLimit? For example to check how much space is left on the 'disk' before writing? Because going over this limit will kill the the app (by evicting the pod) – galusben Nov 18 '20 at 15:36
  • 1
    When in the container the size limit does not reflect when you run a simple `df -h`. So app cannot count on the true "available size" as it's the whole underlying host's disk size. Any idea on resolving this? – Eldad Assis Nov 18 '20 at 15:46