Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

kubernetes

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?

like image 891
C. Russell Avatar asked Mar 06 '19 21:03

C. Russell


1 Answers

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.

like image 129
Crou Avatar answered Sep 23 '22 05:09

Crou