ContainerOOMKilled¶
Severity: warning. Fires when a container restarted at least three times in the last hour and its last termination reason is OOMKilled: it needs more memory than its limit allows, or it leaks.
Labels: namespace, pod, container. The namespace is the component.
Read-only checks¶
# Restarts, last state and the memory limit of the container
kubectl --context <context> -n <namespace> get pod <pod> -o wide
kubectl --context <context> -n <namespace> describe pod <pod> | sed -n '/Containers:/,/Conditions:/p'
# Memory in use now, per container
kubectl --context <context> -n <namespace> top pod <pod> --containers
# What the container logged before it was killed
kubectl --context <context> -n <namespace> logs <pod> -c <container> --previous --tail=100
# Did a deploy start it? Recent revisions of the owner and of its Flux objects
kubectl --context <context> -n <namespace> get pod <pod> -o jsonpath='{.metadata.ownerReferences[*].name}{"\n"}'
flux --context <context> get helmreleases -A | grep <namespace>
In Prometheus, container_memory_working_set_bytes{namespace="<namespace>",pod="<pod>",container="<container>"} shows whether memory grows steadily (a leak) or jumps at a certain moment (one large job or request).
Roll forward¶
The limit is too low for the work: raise resources.limits.memory (and the request with it) in the component's values or manifest in components/<component>/, or in a cluster patch when only one cluster needs it, in a pull request. Leave room on the node: kubectl --context <context> describe node shows what is allocated.
Roll back¶
The OOMs started with a new version (the owner's revision changed shortly before): revert the version bump in a pull request, as in the ops runbook's generic Flux freeze roll-back. Do not raise the limit to hide a leak in a new version.