kubernetes 中容器和 Pod 的磁盘 space 分配

Disk space allocation for a Container and Pod in kubernetes

我知道我们可以在 Kubernetes 中使用 requests and limits 为容器指定 CPU 和内存分配。但是我想知道每个容器分配了多少磁盘space?另外,有没有一种方法可以指定类似于 CPU 和内存分配。

提前致谢。

与CPU和内存资源类似,您可以使用ephemeral storage指定使用的磁盘资源。请求和限制也可以与临时存储一起使用。

更新:

请参考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.

您可以使用与临时存储不同的类型之一,卷中的 emptydir 以持久方式存储数据。