hetzner-mgmt worker memory eviction (2026-11)¶
Kind: reference (investigation and proposal, task #2502)
On 2026-11-04 worker-3 stalled for about 6 minutes without an OOM kill, went NotReady, and
taint-manager evicted gitea-postgresql-0 (incident #2490,
report). The workers run the Talos
kubelet defaults: systemReserved.memory: 384Mi, evictionHard.memory.available: 100Mi, no soft
threshold. The kernel thrashed long before the kubelet saw 100Mi, so nothing was evicted. This page
sizes a kubelet soft-eviction threshold on 7 days of data, gives the settings and what they cost, and
says how they reach the nodes. Data: Prometheus (node-exporter, cAdvisor, kube-state-metrics),
2026-10-28 19:10 to 2026-11-04 19:10 UTC, and the kubelets' configz and stats/summary.
The kubelet does not see MemAvailable¶
The kubelet's memory.available is the node's capacity minus the node's working set
(/api/v1/nodes/<node>/proxy/stats/summary, node.memory.availableBytes). Read together with
node-exporter on 2026-11-04 between 19:01 and 19:05 UTC (three samples on each worker), it matched
MemTotal − Active(anon) − Inactive(anon) − Active(file) within 0.2 GiB. Unlike MemAvailable, it
counts no kernel memory (slab 0.4–0.9 GiB on these workers, page tables, vmalloc). It also counts all
inactive file cache as free, including the cache the kernel is thrashing. It read 0.05–0.74 GiB
above MemAvailable: about 0.6 GiB on worker-1 and worker-3, and 0.1 GiB on worker-2. The
MemAvailable levels in #2502 (stall below ~0.6 GiB, survival at 1.13 GiB) are therefore about
0.6 GiB higher for the kubelet.
There is no history of the kubelet's own value: the root cgroup's cAdvisor series is not scraped. This page replays it from node-exporter:
# the kubelet's memory.available, estimated (GiB)
(node_memory_MemTotal_bytes - node_memory_Active_anon_bytes
- node_memory_Inactive_anon_bytes - node_memory_Active_file_bytes) / 2^30
Stalls in the 7 days¶
A stall here is node-exporter giving no samples for more than 60 seconds, with major page faults above 100/s just before. Two gaps that every target shared (15:02 and 15:07 on 11-04) were Prometheus gaps and are left out.
| Worker, time (UTC) | Kubelet view, last samples (GiB) | MemAvailable |
Gap | Effect | What grew |
|---|---|---|---|---|---|
| worker-3, 10-31 01:20:46 | 2.26 → 1.55 → 2.28 → 1.93 → 1.74 | 0.85 min | 120 s | stayed Ready |
Nothing in pods: their working set stayed at 2.6–2.8 GiB. Cause unknown |
| worker-1, 11-04 13:55:06 | 2.83 → 2.44 → 1.95 | 1.13 | 180 s | NotReady 13:57:30–13:58:30 |
runner pod 1.3 → 2.9 GiB (working set) |
| worker-3, 11-04 17:15:46 | 2.55 → 1.66 → 1.25 | 0.63 | 420 s | NotReady 17:18–17:22, Gitea down 17:17–17:30 (#2490) |
runner pod 1.4 → 2.9 GiB (3.4 GiB at the stall, #2490) |
| worker-2, 11-04 18:41:45 | 2.80 → 2.02 → 1.62 → 1.34 | 0.87 | 210 s | No samples from any node: Prometheus runs on worker-2. Ready as far as recorded |
emilia-container-agent 0.5 → 3.2 GiB (request 1.5 GiB, priority 0) |
- Thrashing (major faults above ~200/s) began at 1.6–2.4 GiB in the kubelet's view (1.0–1.5 GiB
MemAvailable), and the kubelet's view fell 0.3–0.9 GiB per 30 seconds before it. - The 1.13 GiB that #2502 and #2503 cite for worker-1 is the sample at 13:55:36. Worker-1 did not
ride it out: it gave no samples for 3 minutes and was
NotReadyfor one. - Not every stall is a runner: one was a container agent, and one had no pod growth at all.
- worker-1 stalled four more times on 2026-11-06 and 11-07, three of them under a container agent. The roll-up report replays the 2 GiB threshold on them.
Replay of soft thresholds¶
For each threshold: the runs of samples (30 s apart) in which the kubelet's estimated view was below it, all runs and those lasting 30 s or more, per worker over the 7 days. The lead is the time from the first sample below the threshold to the first missing sample of each stall. An eviction needs ~10–20 s to act (the kubelet checks every 10 s, plus the 10 s grace) and up to 10 s more for the pod to stop. So a lead of 30 s is just enough, and a lead of 0 is too late.
| Threshold | worker-1 runs | worker-2 runs | worker-3 runs | Lead: w3 10-31, w1 13:55, w3 17:16, w2 18:42 |
|---|---|---|---|---|
| 1.75 GiB | 5 (0 ≥ 30 s) | 5 (3) | 27 (16) | 0 s, none, 30 s, 30 s |
| 2 GiB | 11 (4) | 9 (3) | 43 (23) | 30 s, 0 s, 30 s, 30 s |
| 2.25 GiB | 23 (8) | 18 (8) | 63 (33) | 30 s, 0 s, 30 s, 60 s |
| 2.5 GiB | 40 (22) | 36 (19) | 110 (47) | 120 s, 30 s, 30 s, 60 s |
| 3 GiB | 124 (63) | 185 (56) | 367 (173) | 150 s, 60 s, 60 s, 90 s |
Which pod the kubelet would have evicted at the start of each run. Under memory pressure the kubelet ranks pods by whether they use more than they request, then by priority, then by how far they are over their request. Replayed from cAdvisor working sets and kube-state-metrics requests:
| Threshold | CI runner (ci-runner, -1000) |
Container agents | Renovate | Other |
|---|---|---|---|---|
| 2 GiB (63 runs) | 46 | 10 | 3 | kustomize-controller 4 |
| 2.25 GiB (104 runs) | 75 | 14 | 5 | kustomize-controller 7, tasks-prod-db 2, hcloud-csi-controller 1 |
2 GiB is the lowest threshold that catches three of the four stalls with ~30 s to spare. It does
not catch worker-1's at 13:55, which fell too fast. That costs about 30–63 evictions a week
(roughly 4–9 a day, most on worker-3). About three quarters would hit a CI runner pod, which ends up
to two jobs, and one in six a container agent, which ends its run. 2.25 GiB adds little lead, but
evicts more and starts to reach tasks-prod-db, Taskbase's database, which was always over its
memory request in that window (before #2556). Stateful pods last (#2544) ranks the stateful pods after every
other pod over its request.
That is far more often than the recommended option of the owner decision #2503 assumes ("revisit if a runner pod is evicted for memory more than about once a week"). Soft eviction is a net that turns most stalls into failed CI jobs. It does not make two image builds on one pod fit a cx33 worker.
Limits of the replay: the kubelet's view is estimated (±0.2 GiB), and the samples are 30 s apart while the kubelet checks every 10 s. A run shorter than the 10 s grace evicts nothing (the ≥ 30 s count is the lower bound). An eviction ends a run early, but a run can also evict more than one pod.
2498's runner limits (4608Mi), merged at the end of the window, are above the runner pods' working¶
set in these stalls (2.9–3.4 GiB), so they do not change the replay.
The settings¶
terraform/environments/hetzner-mgmt-cluster/1-bootstrap/talos-worker-kubelet-patch.yaml, a
worker-only Talos patch (talosctl gen config --config-patch-worker):
machine:
kubelet:
extraConfig:
evictionSoft:
memory.available: 2Gi
evictionSoftGracePeriod:
memory.available: 10s
evictionMaxPodGracePeriod: 10
evictionSoft2Gi: sized above. A soft threshold does not change allocatable (7.08 GiB), so nothing that is scheduled now stops fitting.- Grace 10 s: the threshold must hold over two of the kubelet's checks, which skips one-sample dips. A longer grace is too slow: before the #2490 stall the view fell 0.9 GiB in 30 s.
evictionMaxPodGracePeriod10: a soft eviction stops the pod within 10 s instead of its own grace period. Without it the CI runner would keep its jobs running for up to 1900 s and a container agent for 1800 s, holding the memory while the node stalls. Every evicted pod gets this short stop, including a database that is over its request (Stateful pods last).evictionHardstays at the default (100Mi). The kubelet drops every unset hard signal once one is set, and a higher hard threshold lowers allocatable: worker-2 has 7114Mi of 7246Mi requested.- While the soft threshold is met, the node has
MemoryPressureand the taintnode.kubernetes.io/memory-pressure:NoSchedule, and keeps it for 5 minutes after (evictionPressureTransitionPeriod). Only BestEffort pods are kept off the node in that time. The evicted pod stays as aFailedPod with reasonEvicted, and its Deployment starts a replacement, possibly on the same node. - The control plane (cx23) keeps its defaults: it is out of this task's scope, and its own low memory is an open question of #2490's report.
- A fall too fast for the kubelet's 10 s checks, as on worker-1 at 13:55, is left to Talos's OOM
controller. Its
OOMConfig(#2547) makes it kill the largest pod, limited or not, instead of the largest unlimited platform pod (hetzner-mgmt: Talos's OOM controller).
Not chosen here, for the owner. A larger systemReserved.memory (~1.2 GiB, what the system uses
outside pods during a stall) would make the kernel keep that much for the system. The kubelet limits
the pods' cgroup to capacity minus reserved (enforceNodeAllocatable: [pods]). The kernel would then
OOM-kill inside the pods' cgroup at once, without the kubelet's 10 s polling, and keep the kubelet
answering. But it lowers allocatable by ~0.8 GiB per worker, which worker-2 does not have, and so
depends on #2409 (no new capacity).
Stateful pods last¶
Under memory pressure the kubelet sorts the pods by three keys, in order: whether the pod's working
set is over its memory request, then its priority, lowest first, then how far over its request it
is (rankMemoryPressure in pkg/kubelet/eviction/helpers.go). Priority only orders pods that are on
the same side of their request: a pod under its request goes after every pod over its own,
whatever its priority.
Measured (#2544): the pod cgroup's working set from cAdvisor (container="", the value the
kubelet reads) against the memory request from kube-state-metrics, 7 days to 2026-11-04 21:00 UTC.
| Pod | Request | Working set max | Hours over request (of 168) | Defined in |
|---|---|---|---|---|
tasks-prod/tasks-prod-db-1 |
128Mi | 422Mi | 168 | Skatzi/taskbase |
tasks-dev/tasks-db-1 |
128Mi | 249Mi | 168 | Skatzi/taskbase |
mattermost/mattermost-db-1 |
256Mi | 279Mi | 4 | components/mattermost/base |
keycloak/keycloak-db-1 |
256Mi | 255Mi | 0 | components/keycloak/database |
emiliero-prod/emiliero-db-1 |
256Mi | 229Mi | 0 | Skatzi/emiliero |
gitea/gitea-postgresql-0 |
512Mi | 229Mi | 0 | components/gitea/base (chart) |
terraform-state/terraform-state-db-1 |
256Mi | 205Mi | 0 | components/terraform-state-db/base |
openbao/openbao-0 |
256Mi | 156Mi | 0 | components/openbao/base |
harbor/harbor-database-0 |
200Mi | 134Mi | 0 | components/harbor/base (chart) |
botyard-prod/botyard-prod-db-1 |
128Mi | 124Mi | 0 | Dupondforge/botyard-control |
keycloak/keycloak-0 |
1100Mi | 774Mi | 0 | components/keycloak/base |
In that window, before #2556, only Taskbase's two databases were over their request all the time.
They ranked with the CI runner and the container agents, and ahead of them whenever those were under
their request; that is how the replay above picked tasks-prod-db. Memory read with page cache gives higher figures (the peak of
container_memory_max_usage_bytes: tasks-prod-db 0.98 GiB, keycloak-db 0.66 GiB), but the
kubelet does not count the inactive file cache the kernel can drop.
The PriorityClass. stateful-service, value 1000, preemptionPolicy: Never
(components/priority-classes, applied by the Flux Kustomization priority-classes). It is the
mirror of ci-runner (-1000). Among the pods over their request, every pod without a class
(priority 0) and the CI runner go before a stateful pod. Otherwise it changes little:
- The scheduler tries a pending stateful pod before pods of priority 0. With
Neverit never preempts a pod to make room. Pods of priority 0 could not preempt it before (equal priority), and still cannot. - A pod that names a class that does not exist is refused at creation, so every Flux Kustomization
whose pods name it
dependsOnpriority-classes. - Talos's OOM controller reads no priority: it still kills the largest pod (hetzner-mgmt: Talos's OOM controller).
Where it is set:
| Pod | Field |
|---|---|
keycloak-db-1, mattermost-db-1, terraform-state-db-1 |
CNPG Cluster.spec.priorityClassName |
harbor-database-0 |
chart value database.internal.priorityClassName. The restore check's copy in harbor-scratch keeps priority 0 (components/harbor/backup/scratch-values.yaml) |
keycloak-0 |
Keycloak CR spec.scheduling.priorityClassName |
openbao-0 |
chart value server.priorityClassName |
gitea-postgresql-0 |
chart value postgresql.primary.priorityClassName (Bitnami postgresql subchart). Merged drained (#2557): the restart takes Gitea down |
tasks-prod-db-1, tasks-db-1 |
CNPG Cluster.spec.priorityClassName, in Skatzi/taskbase deploy/{prod,dev}/postgres-cluster.yaml. Merged drained (#2556): the restart takes Taskbase down |
keycloak-db and mattermost-db also request 320Mi instead of 256Mi, which covers their maximum
with ~15–25 %, so they are not counted over their request. That adds 64Mi to worker-2 (6090Mi of
7245Mi requested on 2026-11-04 21:40 UTC) and 64Mi to worker-3 (3798Mi).
tasks-prod-db requests 512Mi and tasks-db 320Mi instead of 128Mi (#2556), above their measured
maxima (422Mi, 249Mi).
Not yet.
emiliero-dbandbotyard-prod-dbbelong to their applications. Either can opt in withpriorityClassName: stateful-servicein itsCluster, together withdependsOnpriority-classeson its Flux Kustomization incluster/hetzner-mgmt/.
What the merge restarts. Each pod restarts once, with its normal grace period, not an eviction.
CNPG recreates the instance pod of keycloak-db, mattermost-db and terraform-state-db (one
instance each: the database is down until the pod is back). The Keycloak operator rolls
keycloak-0, and Harbor's upgrade rolls harbor-database-0. The restarts change no data. OpenBao's
StatefulSet is OnDelete: openbao-0 gets the class when a person restarts it (#2558,
Rolling Out an OpenBao Pod-Template Change),
and KubeStatefulSetUpdateNotRolledOut fires until then.
Check after the merge:
kubectl --context admin@mgmt-cluster get pods -A -o custom-columns=NS:.metadata.namespace,POD:.metadata.name,PRIORITY:.spec.priority --no-headers | awk '$3 == 1000'
# stateful pods over their memory request (bytes over). Main containers only: none of them has a sidecar
(max by (namespace, pod) (container_memory_working_set_bytes{container="", pod!=""})
- on (namespace, pod) sum by (namespace, pod) (kube_pod_container_resource_requests{resource="memory"})) > 0
and on (namespace, pod) kube_pod_info{priority_class="stateful-service"}
Rollout¶
The patch reaches the running workers only through talosctl. Terraform does not re-apply machine
configs (talos_config_generation runs again only when a server is replaced), and agent runners
have no talosctl. A person with the talosconfig applies it, one worker at a time, from
terraform/environments/hetzner-mgmt-cluster/1-bootstrap/. 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.
Apply it (#2543) once the PodEvicted alert treats these evictions as expected (#2542): a CI runner
pod evicted for memory then raises the info alert CIRunnerMemoryEvicted instead of an incident
task, and more than 10 memory evictions in 24 hours on one worker raise NodeMemoryEvictionsFrequent
(which evictions page).
For each worker, worker-3 (10.0.0.22) first, then worker-1 (10.0.0.20) and worker-2 (10.0.0.21):
- Check the node is
Readyand the kubelet'smemory.availableis well above 2 GiB, so the restarted kubelet does not evict at once: - Show the change; the diff must hold only the three keys under
machine.kubelet.extraConfig: - Apply it (the same command without
--dry-run). Expect "Applied configuration without a reboot". - Verify, then wait 10 minutes before the next worker:
kubectl --context admin@mgmt-cluster get --raw /api/v1/nodes/worker-3/proxy/configz \ | jq '.kubeletconfig | {evictionSoft, evictionSoftGracePeriod, evictionMaxPodGracePeriod, evictionHard}' kubectl --context admin@mgmt-cluster get node worker-3 -o jsonpath='{.status.allocatable.memory}{"\n"}' # 7419536Ki, unchanged kubectl --context admin@mgmt-cluster get node worker-3 -o jsonpath='{.status.conditions[?(@.type=="MemoryPressure")].status}{"\n"}' # False
Rollback, per worker, then revert the pull request:
talosctl --talosconfig ./talosconfig --endpoints 78.47.74.196 --nodes 10.0.0.22 patch mc --patch \
'[{"op":"remove","path":"/machine/kubelet/extraConfig/evictionSoft"},{"op":"remove","path":"/machine/kubelet/extraConfig/evictionSoftGracePeriod"},{"op":"remove","path":"/machine/kubelet/extraConfig/evictionMaxPodGracePeriod"}]'
2413's image garbage-collection settings also go under machine.kubelet.extraConfig. A strategic¶
merge patch keeps both sets of keys, and the rollback above removes only these three.
After the rollout¶
# evictions (the message says "low on resource: memory")
kube_pod_status_reason{reason="Evicted"} == 1
# memory pressure per node
kube_node_status_condition{condition="MemoryPressure",status="true"} == 1
# stalls: the longest gap in a worker's node-exporter samples over a day, in seconds
max_over_time((time() - timestamp(node_memory_MemAvailable_bytes))[1d:15s]) > 60
Compare the evictions with the replay above. Revisit the threshold if a worker stalls without an eviction in the minute before, or if evictions are well above ~60 a week.
Measured, 7 days (#2554)¶
From 2026-11-11 19:32 (the last worker) to 11-18 19:32 UTC the kubelets evicted 31 pods for memory: 24 on worker-3, 7 on worker-1, none on worker-2. 23 were CI runner pods: 22 in the 35 hours with two jobs per pod, and 1 in the 5.5 days after the one-job pods were Ready (11-13 06:58,
2931). The other 8 were 4 container agents (emilia 11-12, miki three times on 11-14) and 4¶
hcloud-csi-node pods on worker-3 (11-12 19:03–19:12), which have no PriorityClass. No pod was
evicted for memory after 11-14 13:31. No stateful pod was evicted. No worker stalled or went
NotReady. The lowest MemAvailable was 0.75 GiB (worker-3) and 0.79 GiB (worker-1), both with
two jobs per pod. After the agent evictions of 11-14 it never fell below 1.9 GiB. The kernel's
only OOM kills on a worker were 2 on worker-1 (11-11 21:41) and a container-limit kill of
tasks-prod-db-1's postgres (22 processes, 11-13 18:31), not node pressure.
The two-job rate (about 100 runner evictions a week) was above the replay's 30–63 evictions of all pods. One job per pod brought it to about 1.3 a week, near #2503's threshold, without changing the threshold. The numbers by worker and the peaks are in Seven days after the patch.