Kubernetes storage eviction: find the failed boundary
Separate eviction branches and carry an overlapping-file lifecycle through the Pod, inode and node budgets.
Quick answer
For a Kubernetes Pod evicted for ephemeral storage, first distinguish a Pod storage-limit breach from node filesystem pressure. Inspect the eviction message, the node's conditions, the filesystem that triggered pressure, and the workload's logs, writable layer and disk-backed `emptyDir` use. Increasing one limit cannot repair every branch, and replacing disk scratch with memory-backed storage changes the resource under pressure.
On this page
For a Kubernetes Pod evicted for ephemeral storage, first distinguish a Pod storage-limit breach from node filesystem pressure. Inspect the eviction message, the node's conditions, the filesystem that triggered pressure, and the workload's logs, writable layer and disk-backed emptyDir use. Increasing one limit cannot repair every branch, and replacing disk scratch with memory-backed storage changes the resource under pressure. [1][2][3][4]
Which storage boundary actually failed?#
Scenario: a fictional media service downloads an archive, expands it into /scratch, transforms the files and uploads the result. The Pod is evicted during a larger input. An operator sees an emptyDir size limit and doubles it, but the replacement Pod is evicted on the same node. The first edit may have changed a workload ceiling while the incident was caused by depleted node space or inodes.
Follow the storage boundaries separately. A container has writable-layer and logging use; a Pod can share disk-backed scratch volumes; a node has filesystems that also serve other workloads and system activity. An eviction message is evidence about one of those boundaries. Preserve it before replacing the Pod or clearing its events.
Kubernetes supports different local-storage layouts, and the kubelet's accounting depends on a supported configuration. Filesystem names such as nodefs, imagefs and containerfs are logical observations, not a promise that your node has three separate disks. Use the actual node configuration rather than copying a directory name from another cluster's runbook. [1][2]
For the rest of this case, assume an ordinary container with a disk-backed emptyDir, not a memory-backed volume or a persistent storage claim. That assumption matters: a memory-backed emptyDir contributes to memory use, and a persistent volume has a different lifecycle and capacity contract. Confirm the deployed Pod rather than relying on an old values file. [1][3]
What should you preserve before changing limits?#
Save the affected Pod's JSON, its events, the node name and the relevant node description. Use the real Pod identity and observation time in the incident record. A controller may already have created a replacement with a different name; describing that healthy replacement will not recover the evicted Pod's termination evidence.
# Read-only collection. Replace the namespace, Pod and node names.
kubectl -n media get pod FAILED_POD -o json
kubectl -n media describe pod FAILED_POD
kubectl -n media get events --sort-by=.metadata.creationTimestamp
kubectl get node AFFECTED_NODE -o json
kubectl describe node AFFECTED_NODERead status.reason and status.message, then compare them with container termination records and the event timeline. Keep the distinction between a container termination and whole-Pod eviction. A word such as storage in a deployment dashboard is not enough to identify which control made the decision.
The node's conditions provide another observation. DiskPressure describes pressure reported by the node; compare its transition times with the Pod eviction. A condition that is clear now does not prove it was clear during the incident. Reclamation or the removal of another workload may have changed the node after the Pod disappeared. [2][4]
If node access is permitted, collect filesystem bytes and inode availability through the platform's supported procedure. df -h and df -i answer different questions. Thousands of tiny extracted files can consume inodes without exhausting byte capacity. Keep the mount paths and timestamps beside both outputs, so a large free data disk does not distract from a full filesystem used by the runtime. [2][6]
How do you separate a Pod limit from node pressure?#
Start with the exact eviction message, then follow the matching evidence. A limit branch asks whether the workload exceeded its configured storage allowance. A node-pressure branch asks whether a monitored filesystem crossed an eviction threshold. The same busy exporter can contribute to both, but the repair evidence is different. [1][2]
| Evidence | First investigation | Repair must establish |
|---|---|---|
| Container or Pod storage limit in eviction evidence | Writable layer, logs, shared scratch and configured limits | Expected peak fits the workload's allowance |
| DiskPressure or low filesystem availability | Affected filesystem, neighboring workloads and reclamation | Node headroom remains adequate under expected load |
| Low free inodes with byte space remaining | File count and extraction or cache lifecycle | File lifecycle fits the filesystem's inode capacity |
| Memory pressure after switching scratch to tmpfs | Memory-backed volume plus process memory | The memory budget covers both allocations |
| Accounting disagrees with node disk use | Layout, measurement method and open deleted files | Observed use maps to the kubelet's supported accounting |
Do not conclude that every eviction of a Pod below its own limit is a Kubernetes bug. Node pressure can affect workloads before their individual ceilings are reached. Conversely, a Pod that breaches its allowance does not need the entire node to be full before eviction becomes possible. Preserve both kinds of evidence in the case record.
A storage request also has a different purpose from a limit. It informs placement accounting; it does not preallocate a private disk with the requested capacity. Review requests across the expected number of co-located Pods and the node's allocatable resource. A single-Pod test cannot validate a fleet-level packing decision. [1][4]
Model the exporter's peak before editing YAML#
For the fictional exporter, write down the files that coexist. The downloaded archive remains while the extracted tree is present; the transform may create another output tree before upload. Logs and the container writable layer consume additional local storage outside /scratch. An emptyDir limit describes a volume boundary, not the complete application inventory.
Scenario arithmetic: Start with a labeled planning example, then replace its inputs with observations. Suppose the archive is 300 MiB, the extracted tree is 900 MiB, and output temporarily adds 400 MiB. If all coexist, scratch demand reaches 1,600 MiB before filesystem overhead and other working files. If the application removes the archive before producing output, the peak may differ. The lifecycle, not the sum of final output sizes, determines the model.
Those numbers are a planning example. Replace them with observed maxima from representative inputs, including malformed archives and unusually high file counts. Record compressed bytes, expanded bytes, temporary outputs and file counts separately. A compression ratio alone cannot establish the peak when several phases overlap or when concurrent requests share the same scratch path.
Next, bound the work admitted into the Pod. Limit the number of active transformations per Pod and reject or defer inputs outside the supported expansion contract. Clean up each operation's directory on success and failure, and make startup recovery handle directories left by interrupted processes. A storage limit supplies a final guard; it does not replace application lifecycle control.
What should the configuration communicate?#
The following fragment illustrates separate controls for placement, total container allowance and shared scratch. It is not a sizing recommendation or a complete Pod manifest. Its values must be replaced after measuring the workload, checking sidecars and confirming the node's supported storage layout. [1][3]
spec:
containers:
- name: exporter
resources:
requests:
ephemeral-storage: "2Gi"
limits:
ephemeral-storage: "4Gi"
volumeMounts:
- name: scratch
mountPath: /scratch
volumes:
- name: scratch
emptyDir:
sizeLimit: "3Gi"For this one-container example, a three-GiB scratch ceiling does not reserve the remaining GiB exclusively for logs. The application can still consume space through its writable layer and logging. The total allowance and the volume allowance must both fit the intended lifecycle, and neither creates physical node headroom. [1]
Keep units unambiguous. Kubernetes storage quantities are bytes; lowercase m is a fractional-byte suffix, not shorthand for megabytes. Use explicit Mi or Gi where those are the units in your capacity worksheet. A reviewer should be able to compare the worksheet and manifest without guessing whether a number is decimal or binary. [1]
A namespace quota adds another accounting boundary. The limits.ephemeral-storage quota caps the sum of those limits across Pods in its namespace. Inspect that quota alongside the Pod allowance, but keep it separate from the node filesystem investigation: an aggregate namespace budget is not a private disk allocation. [6]
Include sidecars in the inventory. A log collector may buffer data, and another container can write into a shared scratch volume. Assign an owner to each writer and describe which lifecycle removes its files. Treating only the main process as the storage user can leave the largest source of growth outside the proposed fix.
Why can cleanup leave disk use high?#
Deleting a pathname is not always the same as releasing the backing space immediately. With scan-based accounting, Kubernetes documents a limitation around files deleted while still open: the inode remains until the descriptor closes, while that usage may not be categorized by the scan. A file-counting script and node filesystem availability can therefore disagree. [1]
In our exporter, imagine a transform opens a temporary output, an error handler unlinks its name, and a stalled subprocess retains the open descriptor. Repeating the operation creates more retained space even though listing /scratch looks reassuring. Investigate open files and process ownership through the node team's approved tools; do not treat an empty directory listing as proof that the incident is resolved.
Container restart is not an unconditional scratch reset. An emptyDir belongs to the Pod lifetime, and its contents can survive a container crash while the Pod remains on the node. If the restart path assumes a clean scratch directory, use unique operation directories and an explicit recovery policy. Distinguish retryable inputs from abandoned partial outputs before deleting anything. [3]
Logging is another independent writer. The kubelet manages container-log rotation, but application logs written into an arbitrary path need their own lifecycle. Review both the application and platform configuration. A fix that suppresses all diagnostics may hide the next failure without resolving the file growth that caused this one. [5]
Will tmpfs or a larger node solve it?#
A memory-backed scratch volume can suit small, short-lived intermediates, but it transfers capacity pressure into memory accounting. For the media example, large expansion trees compete with the transform process for memory. The change needs a new budget and a new failure test; it is not simply a faster disk with the same safety margin. [1][3]
A larger node disk can be an appropriate engineering choice when the workload has legitimate local-storage demand and its node pool is undersized. Compare that option with bounded admission and a different scratch lifecycle. Check the actual filesystem layout and node pool before treating extra disk capacity as the repair.
For outputs that must survive Pod loss, move the durable result into storage with the required persistence contract. Local scratch can remain temporary, with a retryable upload step and a recorded completion marker. Do not turn an emptyDir into the only copy of an accepted customer artifact just because it passed a larger-input test once.
What evidence is enough to close the incident?#
Reproduce the original failure path in a controlled environment using representative archives, a defined concurrency level and the same storage layout. Record scratch peak, writable-layer and log growth, inode availability, node headroom and the actual Pod outcome. Run interrupted transformations as well as successful ones so cleanup gets exercised.
Acceptance should cover at least one input near the supported maximum and one input that exceeds the contract. The first must finish without consuming another workload's headroom beyond the planned budget. The second must be rejected or terminated through a documented application path, with recoverable state and useful diagnostics. Do not create a node-pressure incident in a shared production cluster to test this article.
Compare before and after using the same inputs and admission policy. Increasing the disk while halving concurrency does not isolate which repair helped. It may be a valid combined operational change, but record both changes and avoid presenting it as a storage-limit experiment.
Example verification: the archive worksheet arithmetic was checked for coexisting input, expanded files and output, and for a changed cleanup order. The shell was syntax-checked and the YAML reviewed. No Kubernetes cluster, eviction experiment or measured peak was used; the numerical example remains a planning fixture.
Frequently asked questions#
- Does an ephemeral-storage request reserve a private disk?
- No. It participates in scheduling resource accounting. Verify physical filesystem capacity and co-located workload demand separately from the requested quantity. [1][4] It does not preallocate filesystem space.
- Why was the Pod evicted below its own storage limit?
- Node filesystem pressure is a separate eviction path. Inspect the affected filesystem, bytes and inodes, node conditions and the event timeline before changing the Pod limit. [1][2]
- Does restarting the container clear emptyDir?
- A container crash does not remove the Pod from the node, and emptyDir data can survive that crash. Pod removal has a different lifecycle. Design startup recovery explicitly. [3]