Skip to content

Commit b317d78

Browse files
authored
Merge pull request #37420 from mattcary/emptysize
Clarify emptyDir sizeLimit
2 parents ff203b0 + 8eece1b commit b317d78

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

content/en/docs/concepts/configuration/manage-resources-containers.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ or 400 megabytes (`400M`).
346346
In the following example, the Pod has two containers. Each container has a request of
347347
2GiB of local ephemeral storage. Each container has a limit of 4GiB of local ephemeral
348348
storage. Therefore, the Pod has a request of 4GiB of local ephemeral storage, and
349-
a limit of 8GiB of local ephemeral storage.
349+
a limit of 8GiB of local ephemeral storage. 500Mi of that limit could be
350+
consumed by the `emptyDir` volume.
350351

351352
```yaml
352353
apiVersion: v1
@@ -377,7 +378,8 @@ spec:
377378
mountPath: "/tmp"
378379
volumes:
379380
- name: ephemeral
380-
emptyDir: {}
381+
emptyDir:
382+
sizeLimit: 500Mi
381383
```
382384

383385
### How Pods with ephemeral-storage requests are scheduled

content/en/docs/concepts/storage/volumes.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,20 @@ Some uses for an `emptyDir` are:
335335
* holding files that a content-manager container fetches while a webserver
336336
container serves the data
337337

338-
Depending on your environment, `emptyDir` volumes are stored on whatever medium that backs the
339-
node such as disk or SSD, or network storage. However, if you set the `emptyDir.medium` field
340-
to `"Memory"`, Kubernetes mounts a tmpfs (RAM-backed filesystem) for you instead.
341-
While tmpfs is very fast, be aware that unlike disks, tmpfs is cleared on
342-
node reboot and any files you write count against your container's
343-
memory limit.
338+
The `emptyDir.medium` field controls where `emptyDir` volumes are stored. By
339+
default `emptyDir` volumes are stored on whatever medium that backs the node
340+
such as disk, SSD, or network storage, depending on your environment. If you set
341+
the `emptyDir.medium` field to `"Memory"`, Kubernetes mounts a tmpfs (RAM-backed
342+
filesystem) for you instead. While tmpfs is very fast, be aware that unlike
343+
disks, tmpfs is cleared on node reboot and any files you write count against
344+
your container's memory limit.
345+
346+
347+
A size limit can be specified for the default medium, which limits the capacity
348+
of the `emptyDir` volume. The storage is allocated from [node ephemeral
349+
storage](docs/concepts/configuration/manage-resources-containers/#setting-requests-and-limits-for-local-ephemeral-storage).
350+
If that is filled up from another source (for example, log files or image
351+
overlays), the `emptyDir` may run out of capacity before this limit.
344352

345353
{{< note >}}
346354
If the `SizeMemoryBackedVolumes` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) is enabled,
@@ -364,7 +372,8 @@ spec:
364372
name: cache-volume
365373
volumes:
366374
- name: cache-volume
367-
emptyDir: {}
375+
emptyDir:
376+
sizeLimit: 500Mi
368377
```
369378

370379
### fc (fibre channel) {#fc}

0 commit comments

Comments
 (0)