Kubernetes image garbage collection and node disk pressure

Image and log growth fills node disks and triggers pod eviction. This page covers kubelet image garbage collection thresholds, separate image filesystems, registry mirrors and the alerts that fire before eviction starts.

On this page

Why Kubernetes image garbage collection decides whether nodes fill up

Kubernetes image garbage collection decides whether a node's disk fills up with container images and logs, and it is the kubelet that runs it. Left on defaults, the kubelet removes unused images only once disk usage crosses its configured thresholds, so a team that never reviews those settings learns about the problem when pods start being evicted under disk pressure. Plan image garbage collection when you design the cluster, not after the first eviction, and treat it as a node-level control that must be set for every node pool, including control plane and GPU nodes that pull large images.

The trigger for planning is any change that increases the number or size of images on a node: frequent CI-built tags, large machine learning or base images, several teams deploying to shared nodes, or a move from one registry to another. Before go-live, confirm the imageGCHighThresholdPercent and imageGCLowThresholdPercent values in your kubelet configuration, check how your distribution sets them, and confirm which filesystem holds /var/lib/containerd or your runtime's image store. Those checks tell you how much headroom exists before eviction signals fire.

Image garbage collection does not fix everything on its own. It cannot remove images still used by running containers, it does not reclaim container logs (which rotate under separate kubelet settings), and it does not stop a workload from writing large amounts of data into its own filesystem. Container logs, emptyDir volumes and images can share one disk unless you split them, so separate image filesystems, log rotation and alerts well below the eviction threshold are part of the same design. Confirm each of these behaviors against your Kubernetes version's kubelet documentation before you rely on them.

Which disk-pressure controls fit which node situation

This table compares the main controls for keeping node disks from filling with images and logs, from kubelet garbage collection thresholds to node sizing. Read each row by its situation: what the control changes, when it fits, and what it costs in re-pull latency, registry dependency or operational effort. Most clusters combine several of these rather than choosing one.

ControlWhat it controlsWhen it fitsTrade-off to plan for
Kubelet image GC thresholdsWhen kubelet starts deleting unused images (high threshold) and how far it frees space (low threshold) on the image filesystemShared root disk with moderate image churn and enough headroom to absorb bursts between GC runsDeleted images must be pulled again when a pod restarts or reschedules, which adds start latency and registry load
Lower GC thresholdsStarts image cleanup earlier, keeping more free space available at all timesClusters that deploy frequently or run many distinct images on small disksMore frequent re-pulls and higher registry traffic; confirm how your runtime and kubelet version handle the values
Separate image filesystemPlaces container image and writable layer storage on a dedicated disk or partition, isolated from the node root and logsNodes where image growth or log growth could starve the OS or kubelet, or where disk pressure keeps recurringExtra disk to provision and monitor per node, and partition sizing must be set before nodes are built
Registry mirror or pull-through cacheServes image pulls from a nearby cache so deleted images can be fetched quickly without internet accessAir-gapped or bandwidth-limited sites, and clusters that pull the same base images on many nodesAdds a registry dependency: cache outages block pulls, and cache storage needs its own capacity and retention planning
Container log rotationCaps the size and number of container log files written by the runtime and kubeletChatty applications or long-running pods that write large logs to node diskRotated logs are lost sooner, so central log shipping must keep up; confirm rotation settings with your runtime
Node sizing and disk headroomSets how much total disk each node has for images, logs and ephemeral storage before any control actsNew cluster builds, or nodes that repeatedly hit thresholds despite tuned GC and rotationLarger disks raise infrastructure cost per node, and oversizing can hide growth problems until they become expensive
Alerts before evictionWarns operators when node filesystem usage approaches thresholds so they act before kubelet evicts podsEvery production cluster, regardless of which other controls are in placeAlerts need tuning to avoid noise; they also depend on exporting node filesystem metrics from each node

How to configure image garbage collection and alerts step by step

This sequence measures where node disk goes, sets kubelet image and log limits, separates the image filesystem when needed, and adds alerts that fire before eviction starts. Each step ends with a check you can record and repeat.

  1. Measure image and log disk use on each node

    The platform team runs a read-only survey on a sample of nodes in each pool. Check the container runtime's image filesystem with crictl imagefsinfo, list images with crictl images, and measure /var/log/pods and the runtime data directory with du. Identify whether images and container writable layers share the root filesystem. The step is done when you have a per-node table of used and available bytes for each filesystem, with the paths your runtime actually uses.

  2. Record the current eviction thresholds

    Read the kubelet configuration on each node pool and note the evictionHard and evictionSoft settings for nodefs and imagefs, along with any inode signals. Compare them with the growth rate from step one. The security or platform owner signs off on the values before anything changes. The step is done when the thresholds are written into the change record, so later garbage collection settings can be checked against them.

  3. Set image garbage collection thresholds in kubelet

    Edit the kubelet configuration file, or the drop-in your installer uses, and set imageGCHighThresholdPercent, imageGCLowThresholdPercent and imageMinimumGCAge. Also set containerLogMaxSize and containerLogMaxFiles so log growth is capped. Confirm the exact key names in the kubelet configuration reference on kubernetes.io for your Kubernetes version. Restart the kubelet on one node first. The step is done when kubelet reports the new configuration and the node shows the expected image cleanup events after usage passes the high threshold.

  4. Separate the image filesystem where needed

    If the survey in step one showed image growth competing with the root or pod storage, plan a dedicated disk or volume for the runtime image store. Mount it before the runtime starts, move or re-pull images, and confirm the runtime root path points to it. Confirm with your distribution and runtime documentation how the image store is configured. Recovery planning matters here, because the node must be drained before its storage is changed. The step is done when crictl imagefsinfo reports the new mount and kubelet identifies it as the image filesystem.

  5. Add a registry mirror for private clusters

    On clusters without direct internet access, configure a pull-through or local registry mirror that the runtime uses for common base images. This reduces repeated pulls that fill image storage and makes garbage collection less disruptive. For control plane images, kubeadm can pull from a private registry through --image-repository on kubeadm init, documented in the kubeadm init reference. Confirm how workload registry mirrors are declared in your runtime's configuration. The step is done when a test pod pulls a base image through the mirror and the mirror's logs record the request.

  6. Alert before eviction thresholds are reached

    In your monitoring stack, create node filesystem alerts for both the root and image filesystems. Set warning alerts above the garbage collection high threshold and critical alerts below the eviction threshold, using the values recorded in step two. Add an inode usage alert and a restart or eviction event alert from the kubelet. Route alerts to the team that owns node pools. The step is done when a test alert fires on a controlled node and reaches the on-call channel with the node name and filesystem attached.

  7. Verify the settings on a test node

    Choose one node that can be drained safely, fill its image store with a controlled set of test images, and watch the usage cross the high threshold. Confirm that kubelet removes unused images down to the low threshold, that logs stay within the configured caps, and that no eviction occurs above the warning level. Record the before and after values. The step is done when the test results and the alert timeline are attached to the change record, and the settings are approved for rollout to the remaining nodes in each pool.

How image growth moves from garbage collection to eviction

The flow starts when image pulls and container logs write to the image filesystem and the root filesystem on a node. The kubelet watches disk usage and runs image garbage collection when usage crosses its configured thresholds, removing unused images first. If usage keeps climbing, node-pressure eviction signals fire and the kubelet evicts pods. The step that matters most sits before eviction: an alert on rising disk usage gives the operator time to act, such as clearing unused images, moving the image filesystem, or routing pulls through a registry mirror. Check each threshold and alert against your own node sizes and image churn.

Disk growth from image pulls and logs reaches the operator alert before eviction starts.

Security and operational risks of aggressive image cleanup

Image and log cleanup on a node frees disk space, but it also removes the artifacts that rollbacks, restarts and audits depend on. The cards below cover the risks that appear when garbage collection thresholds and mirror operations are tuned without checking those dependencies first.

Rollback images removed too early

Kubelet image garbage collection removes unused images once disk usage crosses its high threshold, and it does not know which image a previous Deployment revision or a restarting pod will need. If a node reboots or a pod is rescheduled after cleanup, the kubelet must pull the image again, which fails when the registry is unreachable or rate-limited. Before lowering thresholds, check which image tags your rollback history references and whether those tags are still available from a registry the node can reach.

Unverified images from open mirrors

A pull-through or local registry mirror that accepts any upstream image makes it easy to run artifacts nobody reviewed. Mirrors also create a second copy under a different name, so a tag that looks identical may point to different content than the original. Require digest pinning for production workloads, restrict which repositories the mirror proxies, and confirm your image signing or scanning step runs on mirrored content, not only on images pushed from your build pipeline.

Registry credentials left on nodes

When kubelet pulls from a private registry, the credentials usually sit in a config.json file on each node or in an image pull secret attached to a service account. Any process with root on the node, or any pod that can mount the host path, can read those credentials. Cleanup jobs that rotate or delete node-level files can also break pulls silently. Confirm where credentials live, scope pull tokens to read-only access on specific repositories, and rotate them on a schedule your team can actually follow.

Log retention against audit needs

Container log rotation and kubelet log settings keep disk use bounded, but they can delete the records your audit or incident process requires. Kubernetes audit logs written on control plane nodes follow their own retention settings, separate from container stdout logs. Decide which records must survive a rotation window, forward them to a central store before local rotation removes them, and document the retention period your compliance owner has approved, since a fast-filling disk should not decide it for you.

Mirror outages blocking restarts

Aggressive cleanup removes the local cache that normally lets a node restart workloads without contacting a registry. If the mirror is down during a maintenance window, pods scheduled to that node may stay in an image pull error state. Test node restarts with the mirror unavailable, keep a small set of base images pinned on every node, and alert on image pull failures separately from disk alerts so the two problems are not confused.

Cleanup settings drifting across nodes

Garbage collection thresholds set by hand on individual nodes, or differing between node pools, lead to inconsistent behavior that is hard to diagnose during an incident. One node may keep images for weeks while another evicts them within hours. Manage kubelet configuration as code, apply it through the same pipeline as other node settings, and check the effective values on each node during upgrades, since kubelet configuration changes can alter what a restarted node keeps on disk.

How long, costly and hard is disk pressure work for our team

What makes disk pressure work take more or less effort?

The main drivers are node count, how often images churn, how many distributions and kubelet setups you run, and whether a registry or mirror already exists. A fleet of a few identical nodes with stable images is far less work than a mixed fleet where each node pool has its own runtime paths, log settings and image sizes. Image churn matters because frequent deploys of large images fill disks faster and make garbage collection thresholds harder to tune. Ask your partner to inventory these four factors before agreeing scope, since they set how many node groups need testing and how many thresholds need to be documented.

Can our internal platform team handle node disk pressure alone?

Often yes, if the team already administers Kubernetes nodes, can change kubelet configuration and has access to node-level metrics. The work becomes harder when the team lacks node shell access in production, does not own the kubelet configuration files, or has no dashboards that show disk usage per node. Check whether one or two engineers can make and roll back kubelet changes without a change freeze, and whether someone can read container runtime and log storage paths. If those answers are unclear, a partner can cover the initial setup while your team takes over the runbooks.

What access does disk pressure work need from our team?

The work needs several kinds of access, each owned by a different group:

  • Node access to read kubelet configuration, runtime paths and disk usage, usually through a bastion or a privileged debug session.
  • Ownership of the kubelet configuration, including the process that rolls changes out to each node pool.
  • Read access to monitoring for node filesystem, inode and image store metrics, plus permission to create alert rules.
  • A place to test changes, such as a non-production cluster with similar node sizes.

Confirm who approves changes to node configuration before the engagement starts, since that approval path often sets the calendar more than the technical work does.

What does a fixed-scope quote for disk pressure work depend on?

A fixed-scope quote follows from the written scope, so it depends on the nodes, distributions, runtimes and filesystems in that scope, plus the registry arrangement and the alerts to be built. DeployOpen does not publish a price list. Ask for the quote to list the node pools covered, the kubelet and runtime settings to be changed, whether a separate image filesystem is in scope, whether a registry mirror is built or only documented, the monitoring and alert work, and the test and rollout approach. Also ask what is excluded, such as application changes that increase image size or log volume.

Which parts of disk pressure work are one-time and which recur?

The initial setup is one-time work: measuring current disk use, setting image garbage collection thresholds, separating the image filesystem where possible, building alerts and writing the runbook. Recurring work comes from changes in the workload and platform. Each Kubernetes minor release has its own support window, so the kubelet and runtime settings should be reviewed during each upgrade. New node pools, larger images, new log sources and changes to the registry all need the thresholds and alerts reviewed again. Ask whether the engagement includes this review or whether it moves to a retainer, since DeployOpen offers ongoing support and upgrades as retainers.

Does disk pressure work depend on which Kubernetes distribution we run?

Yes. The core kubelet settings are the same across distributions, but the way each distribution installs the kubelet, sets the container runtime and places image and log storage can differ. Where you run kubeadm, RKE2, K3s, Talos or another distribution, each node pool may need its own configuration path and its own test. Kubernetes is open source under Apache 2.0, but a distribution's defaults and packaging still decide where files live. Confirm the distribution and version for every node pool, and whether any pool uses a managed service where node configuration is limited.

What should we check before asking a partner for a disk pressure estimate?

Gather a list of node pools with their operating system, disk sizes, runtime and kubelet version, plus the current garbage collection and eviction settings. Add the registry setup, whether images are pulled from the public internet or a private registry, and the alerts you already have. Note which workloads produce large images or logs and how often they deploy. This inventory lets the partner describe effort and scope in terms your team can verify. Without it, any estimate will be based on assumptions, so ask for the assumptions to be written down in the proposal.

What a DeployOpen disk-pressure engagement produces

A disk-pressure engagement ends with a set of written artifacts that your platform and operations teams can run without us. The first is a per-node disk baseline: how much space the image store, container logs, pod writable layers and the kubelet root directory use on each node pool, how that usage moves across a normal day and during deployments, and which nodes already sit near their thresholds. The second is a written kubelet and container runtime configuration covering image garbage collection thresholds, log rotation limits, and whether the image filesystem is separate from the node root filesystem. Where the baseline shows that registry pulls are the main source of churn, the third deliverable is a registry mirror design that describes where mirrors sit, how they are authenticated, and how nodes fail over when a mirror is unavailable.

The fourth deliverable is a set of alert rules tied to the baseline, so that warnings fire while there is still time to act and before the kubelet starts evicting pods under disk pressure. Each rule comes with the signal it watches, the threshold it uses, and the owner who receives it. The fifth is a runbook for responding to those alerts: how to identify the largest consumers on a node, which images and logs are safe to clear, when to cordon and drain instead, and when to escalate to the application owner. Confirm with your team which nodes and workloads are in scope, since disk behavior differs widely between build runners, stateful workloads and general application pools.

Scope, the number of node pools and clusters covered, the environments included and the delivery timeline are agreed in writing before work starts. Ask for the written scope to name the artifacts above, the environments where changes will be tested, who approves kubelet changes on production nodes, and whether a retest of the alert rules is included. Changes to kubelet configuration usually require a node restart or a rolling reconfiguration, so the schedule for applying them belongs in the agreed plan rather than being left to the operations team later.

How DeployOpen scopes and supports node disk work

DeployOpen treats image garbage collection and disk pressure as a design problem tied to your node layout, registry path and alerting, not as a single kubelet setting. Work runs in the clusters and infrastructure you control, under a written scope that is agreed before any change is made.

How we scope

  • Inventory node disk layout, image filesystem placement and current kubelet garbage collection settings in each node pool
  • Agree in writing which image, log and container filesystems are in scope, and which node pools and clusters are covered
  • Define the alert thresholds, owners and escalation path that must exist before eviction signals start firing

How we build

  • Configure kubelet image garbage collection thresholds and separate image filesystems on the agreed node pools
  • Stand up or connect registry mirrors for air-gapped or bandwidth-limited clusters, and test pulls from them under load
  • Test pressure scenarios on non-production nodes, including image churn and log growth, and confirm eviction ordering behaves as designed

How we hand over

  • Deliver the configuration, runbooks and alert rules as documented artifacts that your platform team can review and version
  • Walk your operators through disk triage, image pruning and the steps to take when a node approaches its thresholds
  • Record test results and the open items agreed with your team, so the handover state is clear to auditors and reviewers

How we support

  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts
  • Ongoing support, Kubernetes upgrades and continuous testing are available as retainers for clusters that change over time
  • Revisit thresholds and mirror capacity when node pools, image sizes or Kubernetes minor versions change, under the agreed scope

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.