What happens if a Kubernetes pod exceeds its memory resources 'limit'?

3/6/2019

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.

https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#how-pods-with-resource-limits-are-run

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?

-- C. Russell
kubernetes

2 Answers

3/7/2019

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.

-- Akash Sharma
Source: StackOverflow

3/7/2019

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 its RestartPolicy.

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.

-- Crou
Source: StackOverflow