There's a bit of a vagueness in the Kubernetes documentation about what happens if a pod's memory footprint increases to a point where it exceeds the value specified under resources.limits
.
It specifies that if a pod's footprint grows to exceed its limits
value, it "might be" terminated. What does the "might be" mean? What conditions would result in it being terminated vs which ones would allow it to continue on as-is?
Limits refers to memory and cpu. If memory consumption increases it will be terminated but in case of CPU, os can allow tiny time slices to consume more than allowed CPU share.
Q: What happens if a Kubernetes pod exceeds its memory resources 'limit'?
It will be restarted.
Unlike Pod eviction, if a Pod container is OOM killed, it may be restarted by the
kubelet
based on itsRestartPolicy
.
You can Configure Out Of Resource Handling for your Node
.
Evicting end-user Pods
If the
kubelet
is unable to reclaim sufficient resource on the node,kubelet
begins evicting Pods.The
kubelet
ranks Pods for eviction first by whether or not their usage of the starved resource exceeds requests, then by Priority, and then by the consumption of the starved compute resource relative to the Pods’ scheduling requests.