The node was low on resource ephemeral-storage
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Understanding Ephemeral Storage in Kubernetes
In Kubernetes, nodes are the worker machines that run the containerized applications. Each node possesses a certain amount of resources, including CPU, memory, and disk space, which are allocated across various containers running on it. Among these resources, ephemeral storage plays a critical role, especially in applications that require transient storage space. This article delves into what ephemeral storage is, what it means when a node is low on ephemeral-storage, and strategies to manage it effectively.
What is Ephemeral Storage?
Ephemeral storage refers to non-persistent storage used for temporary data that a pod or container needs during its lifecycle. This storage is not meant for data persistence beyond the pod's lifetime and is created per pod, residing on the underlying node's local storage. Common examples include:
- Scratch space for processing data.
- Cache storage for blazing-fast access to frequently accessed datasets.
- Logs that don't require long-term persistence.
Reasons for Ephemeral-Storage Exhaustion
- Excessive Data Volume: Pods might consume more data storage than anticipated due to bugs, unexpected data input sizes, or growth in usage patterns.
- Improper Cleanup: Logs or temporary files that aren't cleaned up can rapidly consume available storage.
- Resource Misconfiguration: Misconfigured requests and limits concerning ephemeral storage can lead to overprovisioning or underutilization.
- Shared Storage: Multiple pods sharing ephemeral storage on the same node might exceed the node's capacity.
Technical Explanation of the Problem
When a node runs low on ephemeral storage, Kubernetes can evict pods to reclaim space. This eviction is primarily driven by certain conditions:
- Eviction Thresholds: By default, Kubernetes defines hard and soft eviction thresholds for storage. When utilization surpasses these thresholds, Kubernetes might evict pods to prevent the node from becoming entirely unresponsive.
- Hard Threshold: Pods are immediately terminated to free up resources.
- Soft Threshold: Pods get a grace period before eviction, allowing them to potentially resolve the issue on their own.
- Node Pressure: When ephemeral-storage pressure builds on a node, the kubelet detects it and can commence the eviction process based on configured thresholds.
Example Scenario
Consider a Kubernetes cluster where each node has a total ephemeral storage limit set to 50GB. Assume there are five pods running on a node, and each has a varying ephemeral storage requirement:
- Pod A: 10GB
- Pod B: 15GB
- Pod C: 5GB
- Pod D: 5GB
- Pod E: 12GB
At this point, the node's storage is nearly exhausted. If Pod E spikes in storage usage (say, caching a large dataset), ephemeral-storage pressure could trigger the eviction of less priority pods.
Table: Key Points of Ephemeral Storage Management
| Key Aspect | Explanation |
| Role of Ephemeral | Scratch space, caches, logs, & temporary datasets. |
| Common Issues | Overconsumption, improper cleanup, misconfiguration, shared storage issues. |
| Eviction Thresholds | Hard: Immediate eviction; Soft: Grace period eviction. |
| Node Pressure | Monitored by kubelet, leads to potential pod eviction. |
| Capacity Management | Balance pod requests, limits, and node allocations. |
Managing Ephemeral Storage in Kubernetes
- Resource Requests and Limits: Set appropriate resource requests and limits for ephemeral storage in pod specifications to prevent overuse.
- Regular Monitoring: Use monitoring tools like Prometheus with Grafana, and set up alerts to track storage usage trends and anticipate issues before they lead to eviction.
- Efficient Cleanup: Implement log rotation and automatic cleanup scripts within containers to manage temporary files effectively.
- Node Configuration: Properly configure node-level storage limits and consider nodes with larger storage options if your workloads demand substantial ephemeral storage.
- Pod Priority and Preemption: Assign priorities to pods so that critical services are less likely to be evicted in response to storage pressure:
Conclusion
Ephemeral storage is a crucial, albeit non-persistent, component of Kubernetes nodes, enabling efficient data processing and temporary storage. Understanding the reasons behind ephemeral-storage exhaustion and how to manage it effectively can help prevent pod evictions and maintain application reliability. By configuring resources judiciously, employing monitoring tools, and setting priority levels, Kubernetes users can better manage ephemeral storage and its impacts on their workloads.
Related reading
- Timeout for Kubectl exec
- Tool to create mongodb sharded cluster
- Tradeoff between building own distributed system and using kubernetes to deploy my application
- Traefik Forward Authentication in k8s ingress controller
- The performance impact of using instanceof in Java
- The performance test of MySQL and TiDB by our DBA shows that a standalone TiDB is not as good in performance as MySQL
- Traefik v2.2 Ingress Route example not working
- Trouble connecting to postgres from outside Kubernetes cluster

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.