Kubernetes Garbage Collection - no free space
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
When a Kubernetes node reports "no free space," the problem is usually local node storage exhaustion, not a failure of the API-level garbage collector. In practice, the pressure comes from container images, writable layers, logs, dead containers, or emptyDir data filling the node's filesystem. The fix is to identify which storage path is full and whether kubelet image garbage collection or node eviction is failing to reclaim enough space.
Know Which Kind of Garbage Collection Is Involved
Kubernetes uses the phrase garbage collection in more than one place. For this error, the relevant mechanisms are usually on the node:
- image garbage collection by kubelet
- dead container cleanup by the container runtime
- pod eviction when disk pressure thresholds are crossed
That is different from owner-reference cleanup in the control plane. If a node cannot pull images or start pods because disk is full, you need node-level debugging.
Inspect the Node First
Start by checking node conditions and recent events.
Look for conditions such as:
- '
DiskPressure=True' - image garbage collection failures
- eviction messages
- pod sandbox creation failures
Then inspect the node directly.
On modern Kubernetes nodes using containerd, /var/lib/containerd is a common source of space usage. On older Docker-based nodes, the heavy path may be under /var/lib/docker.
Check Kubelet and Runtime Cleanup
If kubelet is supposed to reclaim space but does not, look at its logs.
The goal is to answer two questions:
- is kubelet trying image garbage collection
- is the container runtime holding onto images, dead containers, or logs
If unused images have accumulated, runtime-level cleanup may help immediately.
That is a tactical fix, not a long-term policy. If the node fills up again tomorrow, you still need to understand why normal reclamation was not enough.
Understand Disk Pressure Behavior
Kubelet monitors node filesystems and can start evicting pods or deleting images when thresholds are crossed. If those thresholds are too lenient for the workload, the node can hit an operational cliff before cleanup frees enough space.
Common contributors include:
- very large container images
- chatty applications producing huge logs
- '
emptyDirvolumes growing without limits' - completed jobs and dead containers piling up
- image pull churn from frequent deployments
A node with small root storage is especially vulnerable. In many clusters, the real fix is to increase node disk size or reduce image and log footprint rather than repeatedly pruning by hand.
Example Cleanup Workflow
A reasonable on-call workflow looks like this:
After cleanup, watch the node condition from the control plane:
If DiskPressure clears and new pods schedule normally, the immediate incident is resolved. Then follow up with a permanent fix such as smaller images, shorter log retention, or larger node disks.
Common Pitfalls
- Debugging API-object garbage collection when the real issue is node-local disk exhaustion.
- Looking only at pod status and never checking the node filesystem directly.
- Cleaning images manually without investigating why kubelet GC or eviction did not protect the node.
- Ignoring large log files or
emptyDirusage and blaming only container images. - Assuming every cluster still uses Docker paths instead of checking the active container runtime.
Summary
- "No free space" in Kubernetes usually points to node-local storage pressure.
- Check node conditions, kubelet logs, and the container runtime storage paths first.
- '
DiskPressure, image buildup, logs, andemptyDirgrowth are common causes.' - '
crictl rmi --prunecan help tactically, but it is not the whole solution.' - Permanent fixes usually involve smaller images, log control, or larger node storage.
Related reading
- Kubernetes get nodeport mappings in a pod
- Kubernetes get the full pod name as environment variable
- Kubernetes Gitlab How to store password for private registry?
- Kubernetes gives an internal source IP although externalTrafficPolicy is set to Local
- Kubernetes Helm, combine two variables with a string in the middle
- Kubernetes hostPath storage permissions
- Kubernetes gke get name of pod network interface
- Kubernetes GPU support how to enable?

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.