How do I limit container disk usage without evicting?

3/19/2019

I'm trying to use Kubernetes on GKE (or EKS) to create Docker containers dynamically for each user and give users shell access to these containers and I want to be able to set a maximum limit on disk space that a container can use (or at least on one of the folders within each container) but I want to implement this in such a way that the pod isn't evicted if the size is exceeded. Instead ideally a user would get an error when trying to write more data to disk than the specified limit (e.g., Disk quota exceeded, etc).

I'd rather not have to use a Kubernetes volume that's backed by a gcePersistentDisk or an EBS volume to minimize the costs. Is there a way to achieve this with Kubernetes?

--
docker
eks
google-kubernetes-engine
kubernetes
resources

1 Answer

3/19/2019

Assuming you're using emptyDir volume on Kubernetes, which is a temporary disk attached to your pod, you can set a size for that.

See the answer at https://stackoverflow.com/a/45565438/54929, this question is likely a duplicate.

-- AhmetB - Google
Source: StackOverflow