From 8eece1b4b4c481c90adb3f7078f5c6ec070878ad Mon Sep 17 00:00:00 2001 From: Matthew Cary Date: Thu, 20 Oct 2022 15:58:28 -0700 Subject: [PATCH] Clarify emptyDir sizeLimit --- .../manage-resources-containers.md | 6 +++-- content/en/docs/concepts/storage/volumes.md | 23 +++++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/content/en/docs/concepts/configuration/manage-resources-containers.md b/content/en/docs/concepts/configuration/manage-resources-containers.md index ce290c33e1..2e8981e4b9 100644 --- a/content/en/docs/concepts/configuration/manage-resources-containers.md +++ b/content/en/docs/concepts/configuration/manage-resources-containers.md @@ -346,7 +346,8 @@ or 400 megabytes (`400M`). In the following example, the Pod has two containers. Each container has a request of 2GiB of local ephemeral storage. Each container has a limit of 4GiB of local ephemeral storage. Therefore, the Pod has a request of 4GiB of local ephemeral storage, and -a limit of 8GiB of local ephemeral storage. +a limit of 8GiB of local ephemeral storage. 500Mi of that limit could be +consumed by the `emptyDir` volume. ```yaml apiVersion: v1 @@ -377,7 +378,8 @@ spec: mountPath: "/tmp" volumes: - name: ephemeral - emptyDir: {} + emptyDir: + sizeLimit: 500Mi ``` ### How Pods with ephemeral-storage requests are scheduled diff --git a/content/en/docs/concepts/storage/volumes.md b/content/en/docs/concepts/storage/volumes.md index c81d85b357..8c357c0948 100644 --- a/content/en/docs/concepts/storage/volumes.md +++ b/content/en/docs/concepts/storage/volumes.md @@ -335,12 +335,20 @@ Some uses for an `emptyDir` are: * holding files that a content-manager container fetches while a webserver container serves the data -Depending on your environment, `emptyDir` volumes are stored on whatever medium that backs the -node such as disk or SSD, or network storage. However, if you set the `emptyDir.medium` field -to `"Memory"`, Kubernetes mounts a tmpfs (RAM-backed filesystem) for you instead. -While tmpfs is very fast, be aware that unlike disks, tmpfs is cleared on -node reboot and any files you write count against your container's -memory limit. +The `emptyDir.medium` field controls where `emptyDir` volumes are stored. By +default `emptyDir` volumes are stored on whatever medium that backs the node +such as disk, SSD, or network storage, depending on your environment. If you set +the `emptyDir.medium` field to `"Memory"`, Kubernetes mounts a tmpfs (RAM-backed +filesystem) for you instead. While tmpfs is very fast, be aware that unlike +disks, tmpfs is cleared on node reboot and any files you write count against +your container's memory limit. + + +A size limit can be specified for the default medium, which limits the capacity +of the `emptyDir` volume. The storage is allocated from [node ephemeral +storage](docs/concepts/configuration/manage-resources-containers/#setting-requests-and-limits-for-local-ephemeral-storage). +If that is filled up from another source (for example, log files or image +overlays), the `emptyDir` may run out of capacity before this limit. {{< note >}} If the `SizeMemoryBackedVolumes` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) is enabled, @@ -364,7 +372,8 @@ spec: name: cache-volume volumes: - name: cache-volume - emptyDir: {} + emptyDir: + sizeLimit: 500Mi ``` ### fc (fibre channel) {#fc}