Disk space allocation for a Container and Pod in kubernetes

9/25/2019

I am aware that we can specify CPU and memory allocation for a Container using requests and limits in Kubernetes. But I would like to know how much disk space gets allocated to each container? Also, is there a way to specify this similar to CPU and memory allocation.

Thanks in advance.

-- Newbie
diskspace
kubernetes
storage

1 Answer

9/25/2019

Similarly to the CPU and memory resources, you can use ephemeral storage to specify disk resources used. Requests and limits can also be use with ephemeral storage.

Update:

Please refer to volumes:

On-disk files in a Container are ephemeral, which presents some problems for non-trivial applications when running in Containers. First, when a Container crashes, kubelet will restart it, but the files will be lost - the Container starts with a clean state. Second, when running Containers together in a Pod it is often necessary to share files between those Containers. The Kubernetes Volume abstraction solves both of these problems.

You can use one of the different types than ephemeral-storage,emptydir from volumes to store your data in persistent way.

-- Alassane Ndiaye
Source: StackOverflow