How to limit the amount of disk used by a Kubernetes emptyDir Volume?

8/25/2018

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)?

-- ams
kubernetes
persistent-volumes

1 Answer

8/25/2018

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

-- imsky
Source: StackOverflow