Understand how resources are allocated to nodes
OpenShift Container Platform uses a script to determine optimal CPU and memory resources for the node and system components on your nodes. Or, you can manually set these values as needed. Ensuring proper resources for these services can help ensure that your cluster is operating efficiently.
These resource calculations are based on the installed CPU and memory capacity on each node and assigned upon node start up. These resources are reserved for the node and system components in the systemd system.slice cgroup, such as CRI-O and kubelet. By default, before the scripts runs, OpenShift Container Platform reserves 500m for CPU and 1 Gi of memory for the node and system components.
|
|
The Kubernetes |
The script uses the following calculations by default.
- Memory reservation
-
The memory reservation is weighted. For smaller nodes, OpenShift Container Platform reserves a higher percentage of memory. For larger nodes, OpenShift Container Platform reserves a smaller percentage of the remaining capacity.
OpenShift Container Platform uses the following calculations to determine how much memory to reserve for node and system components:
-
25% of the first 4 GiB of memory
-
20% of the next 4 GiB of memory (up to 8 GiB)
-
10% of the next 8 GiB of memory (up to 16 GiB)
-
6% of the next 112 GiB of memory (up to 128 GiB)
-
2% of any memory above 128 GiB
For example, on node with 16 GiB of memory, OpenShift Container Platform reserves 2.6 GiB for node and system components, leaving approximately 13.4 GiB for workloads.
-
- CPU reservation
-
OpenShift Container Platform uses the following logic to determine how much CPU to reserve for node and system components:
-
OpenShift Container Platform starts with a base allocation for 1 CPU in fractions of a core (60 millicores = 0.06 CPU core).
-
Then, it increments 12 millicores (0.012 CPU) for every additional core beyond the first.
-
The result is compared against a minimum floor of 0.5 CPU. If the calculated value is less than 0.5, the system enforces a reservation of 0.5 CPU.
For example, on a 4-core node, 0.5 vCPU is reserved for node and system components, leaving 3.5 vCPUs for workloads. Note that 1000 millicores is equal to 1CPU/vCPU.
Any CPUs specifically reserved using the
reservedSystemCPUsparameter in aKubeletConfigobject are not available for allocation usingsystem-reserved. -
You can manually manage CPU and memory reservations for the node and system components by configuring the system-reserved parameter in a KubeletConfig object, as described in "Manually allocating resources for nodes".