PodEvicted¶
Severity: warning. Fires when the kubelet evicted a pod in the last 6 hours: the node ran short of disk (ephemeral-storage), memory or PIDs, and the kubelet killed the pod that used most over its request. Its containers, and any CI jobs or requests they ran, were killed. The controller starts a replacement; the evicted Pod object stays (Failed, reason Evicted) until someone deletes it.
Labels: namespace, pod. The namespace is the component. The alert fires 5 minutes after the eviction and stops 6 hours after it, whether or not the cause is fixed; NodeEphemeralStorageLow fires while the disk is still short.
Which evictions page¶
| Eviction | Alert | Incident |
|---|---|---|
Any pod for disk (nodefs, imagefs, an ephemeral-storage or emptyDir limit) or PIDs |
PodEvicted |
yes |
| Any pod for memory except a CI runner: container agents, databases, controllers | PodEvicted |
yes |
A CI runner pod (gitea-act-runner-* in gitea) for memory, on a node that evicted for nothing else in the 6 hours |
CIRunnerMemoryEvicted (info) |
no |
| The same, on a node that also evicted for anything else in the 6 hours | PodEvicted |
yes |
| More than 10 pods for memory in 24 hours on one node | NodeMemoryEvictionsFrequent | yes |
CI runner memory evictions¶
Once the hetzner-mgmt workers have the soft memory-eviction threshold, evicting a CI runner pod for memory is the designed way out of a two-job peak, not a fault (hetzner-mgmt worker memory eviction; the replay there predicts 4–9 memory evictions a day, about three quarters of them a runner). So it raises the info alert CIRunnerMemoryEvicted (labels namespace, pod, node) instead of an incident. Info alerts are not sent to Mattermost while no warning fires in their namespace (the InfoInhibitor); they show in Prometheus (ALERTS{alertname="CIRunnerMemoryEvicted"}) and in Alertmanager with inhibited alerts shown. Too many of them open the incident NodeMemoryEvictionsFrequent.
How the rule tells memory from disk: the resource is only in the Pod's .status.message ("The node was low on resource: memory"), which no metric carries; kube_pod_status_reason{reason="Evicted"} has no resource label. The kubelet's own counter kubelet_evictions names it (eviction_signal, e.g. memory.available, nodefs.available, ephemeralpodfs.limit), but per node, not per pod. The recording rule namespace_pod_node:ci_runner_memory_evicted:6h (components/prometheus-stack/config/prometheus-rules.yaml) joins the two through kube_pod_info's node: a runner pod newly Evicted whose node's counter rose for memory.available (or allocatableMemory.available) in the last 6 hours, and for no other signal. When a node evicted for memory and for something else in the same 6 hours, the rule cannot tell which eviction hit the runner, so it pages; it may then start paging for a runner eviction it first took as memory. The 5 minutes of PodEvicted give the kubelet's counter time to be scraped after the Pod's reason.
Read-only checks¶
# The resource and what each container used: the eviction message
kubectl --context <context> -n <namespace> get pod <pod> -o jsonpath='{.status.message}{"\n"}'
# Where it ran, and whether the node still has the pressure
kubectl --context <context> -n <namespace> get pod <pod> -o wide
kubectl --context <context> describe node <node> | sed -n '/Conditions:/,/Addresses:/p'
# Disk use now, per pod on that node (the kubelet's own numbers)
kubectl --context <context> get --raw /api/v1/nodes/<node>/proxy/stats/summary \
| jq -r '.node.fs, (.pods[] | "\(.podRef.namespace)/\(.podRef.name) \(."ephemeral-storage".usedBytes)")'
# Other evictions
kubectl --context <context> get pods -A --field-selector=status.phase=Failed | grep Evicted
In Prometheus, node_filesystem_avail_bytes{mountpoint="/var"} shows how fast the node filled. On Talos /var holds images, container layers, logs and emptyDir volumes; the kubelet evicts below 15 % free.
Roll forward¶
The pod writes more than the node has room for, or writes without bound: give its containers resources.requests/limits.ephemeral-storage sized on what the eviction message shows, and bound what it writes (a cleanup, an emptyDir sizeLimit, or a PVC for data that should persist) in components/<component>/ in a pull request. For memory, raise the memory request as in ContainerOOMKilled, unless the pod is a container agent whose larger request cannot fit (below). The other exception is a CI runner pod (gitea-act-runner-*) evicted for memory, which does not page on its own (above); when it pages because its node also evicted for something else, check the message: for memory, it is not a request to raise, so work the node's other eviction instead. The Gitea CI runners' disk use is sized in CI Runners.
When the pod is replaced and the cause fixed, the evicted Pod objects can be deleted (kubectl --context <context> -n <namespace> delete pod <pod>; they hold no data). Log it in the run report.
Container agents¶
A container agent (*-container-agent in agent-runners, with resize on) is scheduled by its 512Mi idle request and grows in place to its active request only while it has a run (Idle and active size). A run can use up to its 4Gi limit whatever it requests. The worker memory eviction design expects about one memory eviction in six to hit a container agent, which ends its run. Before raising its request:
-
Was it the only pod over its request? Run this in Prometheus at the eviction time (from the
Evictedevent), with the node from the read-only checks:# pods on the node over their memory request (bytes over) (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{node="<node>"}If the agent is the only pod returned, the soft-eviction net worked as designed and nothing is misconfigured. If other pods are returned too, the kubelet ranked them by priority and by how far each was over; look at what drove the node's memory down before changing the agent.
-
Does the larger active request fit in place? A grow needs the difference between the active and the idle request free on the node the replacement runs on:
# Memory requested on the node, and its share of allocatable kubectl --context <context> describe node <node> | sed -n '/Allocated resources:/,/Events:/p' # A grow that does not fit: reason Deferred (no room now) or Infeasible (never) kubectl --context <context> -n agent-runners get pod <pod> \ -o jsonpath='{.status.conditions[?(@.type=="PodResizePending")]}{"\n"}' -
If it does not fit, do not raise the request. A larger
resources.requests.memoryis thenDeferred, and the run stays at its 512Mi idle request, even further over it. Add the measurements (the runner's working-set quantiles, memory requested per worker) to #2407, the capacity question, and close the incident as mitigated, with an incident report. Incident #2884 is the example. -
Check that the replacement went back to its own worker. The agents may not run on worker-2 (#2992) and may not share a worker (#2999), so while the evicting node has
MemoryPressurethe replacement staysPending(FailedScheduling: the taint, the anti-affinity and the node affinity); it schedules on the same worker once the taint clears, 5–8 minutes after the eviction (pod placement). Nothing is moved by hand: the agents cannot stack, so there is nothing to move back.# One Running *-container-agent pod per worker, worker-1 and worker-3 kubectl --context admin@mgmt-cluster -n agent-runners get pods -o wide # A Pending replacement: why it waits kubectl --context admin@mgmt-cluster -n agent-runners describe pod <pod> | sed -n '/Events:/,$p' # Its worker's MemoryPressure (False once the taint clears) kubectl --context admin@mgmt-cluster get node <node> \ -o jsonpath='{.status.conditions[?(@.type=="MemoryPressure")].status}{"\n"}'Check that
list_runnersshows the runner online again. If the replacement is stillPendingafter its worker showsMemoryPressureFalse, or its worker isNotReady, cordoned or gone, that agent waits for the worker (what it costs);KubePodNotReadyfires after 15 minutes. Do not relax the affinity by hand: bring the worker back, or change the rules in Git and say why.
Roll back¶
The evictions started with a new version (the owner's revision changed shortly before) that writes much more: revert the version bump in a pull request, as in the ops runbook's generic Flux freeze roll-back.