hetzner-mgmt worker image garbage collection (2026-11)¶
Kind: how-to (node configuration, tasks #2413 and #3480)
The kubelet on the hetzner-mgmt workers removes unused container images only once /var is 85 %
used (imageGCHighThresholdPercent: 85, imageGCLowThresholdPercent: 80,
imageMaximumGCAge: 0s in /api/v1/nodes/<node>/proxy/configz). 85 % used is also where it starts
evicting pods (imagefs.available: 15%). So every replaced image version stays on the node until it
is almost full. On 2026-11-19 worker-1 and worker-2 each kept 38–39 GB of images (against ~20 GB on
2026-11-10). With a CI runner pod on it, worker-2 swung between 20 % and 27 % free.
NodeEphemeralStorageLow (under 25 % free) fired at 19:21 and again at 21:14 UTC (#3480,
report).
2404 found the cause and #2413 proposed the fix.¶
The settings¶
Three keys under machine.kubelet.extraConfig in
terraform/environments/hetzner-mgmt-cluster/1-bootstrap/talos-worker-kubelet-patch.yaml, the
worker-only Talos patch that also holds the memory eviction
settings:
- 60 % / 50 %. Over 60 % of
/varused (46.6 GB of 77.6 GB), the kubelet removes unused images, least recently used first, until 50 % is used or no unused image is left. That leaves 15 points (11.6 GB) before the alert's 75 % for what grows between two collections (the kubelet checks every 5 minutes). At 70 % it would leave 5 points: worker-2 lost 4.8 points in 15 minutes of CI jobs on 2026-11-19 (25.2 % free at 20:46, 20.4 % at 21:01 UTC). Images that running pods use are never removed. The current Renovate image and the images the restore drills use are the most recently used ones, so they go last. No threshold helps once a runner pod at its 36 GiB limit (about 50 % of the disk, Disk) plus the images in use fill the node; that is the runner's sizing, not image collection. - 168 h. An image that no container has used for 7 days goes whatever the disk use. That removes old versions on a quiet node too.
- Cost. A removed image that is needed again is pulled again from Harbor or its upstream: a
Renovate version is ~450 MB compressed, Mattermost ~800 MB.
imageMinimumGCAgestays at its 2 minute default, so a freshly pulled image is never removed before its container starts.
Kubernetes is 1.36 on Talos 1.13, where imageMaximumGCAge needs no feature gate.
Rollout¶
Terraform does not re-apply machine configs, and agent runners have no talosctl. A person with
the talosconfig applies the patch from terraform/environments/hetzner-mgmt-cluster/1-bootstrap/
after this pull request is merged, one worker at a time. The endpoint and node IPs are those of
Talos OS Upgrade. Changing machine.kubelet restarts the
kubelet without a reboot, and running pods keep running.
For each worker, worker-2 (10.0.0.21) first because it is the one that fires, then worker-1
(10.0.0.20) and worker-3 (10.0.0.22):
- Check that the node is
Readyand note its use: - Show the change. The memory eviction keys are already applied, so the diff must hold only the three image keys:
- Apply it (the same command without
--dry-run). Expect "Applied configuration without a reboot". - Verify, then wait 10 minutes before the next worker:
The kubelet's image garbage collection runs every 5 minutes. On a node over 60 % used, the images in
kubectl --context admin@mgmt-cluster get --raw /api/v1/nodes/worker-2/proxy/configz \ | jq '.kubeletconfig | {imageGCHighThresholdPercent, imageGCLowThresholdPercent, imageMaximumGCAge, evictionSoft}' kubectl --context admin@mgmt-cluster get node worker-2 # Readystats/summary(.node.runtime.imageFs.usedBytes) then fall.
Rollback, per worker, then revert the pull request:
talosctl --talosconfig ./talosconfig --endpoints 78.47.74.196 --nodes 10.0.0.21 patch mc --patch \
'[{"op":"remove","path":"/machine/kubelet/extraConfig/imageGCHighThresholdPercent"},{"op":"remove","path":"/machine/kubelet/extraConfig/imageGCLowThresholdPercent"},{"op":"remove","path":"/machine/kubelet/extraConfig/imageMaximumGCAge"}]'
This leaves the memory eviction keys in place.
After the rollout¶
What the settings can and cannot do decides when #2413 is done. Below 60 % used the threshold does nothing, so a worker without a runner pod (worker-1 used 41 GB, 53 %, on 2026-11-19) loses only the images no container has used for 7 days. How much that leaves depends on how many image versions the week's Renovate bumps and drills pulled, so there is no fixed size to expect. The ~17 GB baseline of the ci-runners Disk design is therefore not a target of these settings. What keeps the alert away is the threshold: once a runner pod pushes a worker over 60 %, the kubelet removes unused images until 50 %.
2413 is done when all three hold:¶
- Within one collection of applying. On a worker over 60 % used when it is patched (worker-2
was at 76 % on 2026-11-19), the images in
stats/summary(.node.runtime.imageFs.usedBytes) fall within 5 minutes, and/varcomes down to about 50 % used (38.8 GB). If it stays higher, the kubelet found too few unused images and says so on the node: The rest is then in use by running pods, which is the runner's sizing, not image collection. - For the 7 days after the last worker. No worker stays over 60 % used for longer than 10
minutes (two collections) without such an event, and
NodeEphemeralStorageLowdoes not fire. If it fires, its runbook tells kept images from a runner pod: kept images mean these settings fall short; a runner pod over its trim bounds is a ci-runners task. Used fraction per worker, to graph over the 7 days: - After those 7 days.
imageMaximumGCAgehas removed every image no container used in the week. On a worker without a runner pod,.node.runtime.imageFs.usedBytesis below its 38 GB of 2026-11-19. Record the value on #2413 and in the ci-runners Disk section, in place of the ~17 GB it assumes.
This replaces step 3 of #2413 ("under ~17 GB after the next GC"), which the 60 % threshold cannot meet on a worker below it.