Kubernetes emptyDir volumes - scratch space, Memory medium and sizeLimit
Answer: When a Pod defines an emptyDir volume, Kubernetes creates that volume as the Pod is assigned to a node. The emptyDir volume is initially empty. When a Pod is removed from a node, the data in the emptyDir is deleted permanently.
Example
apiVersion: v1
kind: Pod
metadata:
name: cache
spec:
containers:
- name: app
image: example/app
volumeMounts:
- mountPath: /cache
name: cache
volumes:
- name: cache
emptyDir:
medium: Memory
sizeLimit: 256Mi
Behavior
- Every container in the Pod can read and write the same files in the emptyDir volume.
- A container crashing does not remove a Pod from a node, so the data remains.
- If you set
emptyDir.mediumto"Memory", Kubernetes mounts a tmpfs (RAM-backed filesystem) for you instead. Files you write then count against the memory limit of the container that wrote them. - A
sizeLimitcan be specified, which limits the capacity of the emptyDir volume.
See also
Claims
- id: C1 claim: emptyDir data is deleted when the Pod leaves the node. source: S1 evidence: "the data in the emptyDir is deleted permanently"
- id: C2 claim: A container crash does not remove the Pod from the node. source: S1 evidence: "A container crashing does not remove a Pod from a node"
- id: C3 claim: Memory-backed emptyDir uses tmpfs. source: S2 evidence: "tmpfs (RAM-backed filesystem) for you instead"
Sources
- [S1] Volume Types. Kubernetes docs. https://kubernetes.io/docs/reference/storage/volume-types/ . License: CC-BY-4.0. Accessed 2026-11-18.
- [S2] volume-types.md. kubernetes/website (GitHub). https://github.com/kubernetes/website/blob/main/content/en/docs/reference/storage/volume-types.md . License: CC-BY-4.0. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Volume Types; kubernetes/website (GitHub), volume-types.md. CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Volume Types; kubernetes/website (GitHub), volume-types.md. CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors.
Cite this
iinventedlight. 2026. "Kubernetes emptyDir volumes - scratch space, Memory medium and sizeLimit." iinventedlight Library, iil:note:618bx875, version of 2026-11-18. https://iinventedlight.com/library/notes/kubernetes-emptydir/. License: CC-BY-4.0.
@misc{iil_note_618bx875,
author = {{iinventedlight}},
title = {{Kubernetes emptyDir volumes - scratch space, Memory medium and sizeLimit}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/kubernetes-emptydir/},
note = {Permanent ID iil:note:618bx875. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/kubernetes-emptydir.md.