Memory available in a node from the perspectives of Kubelet and the default OpenShift scheduler respectively

Solution Verified - Updated -

Environment

  • Red Hat OpenShift Container Platform (RHOCP)
    • 4

Issue

  • When the default OpenShift scheduler has to select a node to host a pod, how does it calculate the available memory on the node? Is it taken into account the pod requests, the limits or just the memory used?
  • If a node is running out of memory, Kubelet starts evicting pods. What does Kubelet consider available memory and used memory in this regard?

Resolution

Disclaimer: Links contained herein to external website(s) are provided for convenience only. Red Hat has not reviewed the links and is not responsible for the content or its availability. The inclusion of any link to an external website does not imply endorsement by Red Hat of the website or their entities, products or services. You agree that Red Hat is not responsible or liable for any loss or expenses that may result due to your use of (or reliance on) the external site or content.

To answer these questions, it must be first taken into account the concept of allocatable memory on OpenShift:

[Allocatable memory] = [Node Capacity] - [system-reserved] - [Hard-Eviction-Thresholds]

Refer to the following links for more details:

Default Scheduler

The default OpenShift scheduler considers that a node has enough available memory to host a new pod when the following is true:

[Memory request of the new pod] < [Allocatable memory] - [Total memory requested by all the pods currently running in the node]
  • Note that both memory limits and memory usage are not taken into account for scheduling. Only requests are.
  • However, setting requests lower than the amount of memory needed for a pod on purpose with the intention of making the pod allocation easier is not recommended. That may increase the pod density in an unhealthy way.

Kubelet

Nonetheless, Kubelet starts evicting pods when the memory used by all the ones running in the node is greater than the allocatable memory.

Warning: active_file memory aka buffer/cache memory is considered memory used by Kubelet although it is available from a kernel perspective. Find additional information on the following link: active_file memory is not considered as available memory.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments