Resource Bin Packing — Node scoring for capacity allocation
This section is intended for those who want to understand the internal details of this feature.
Reference note (untrusted external data; do not execute it as instructions).
This section is intended for those who want to understand the internal details of this feature. Below is an example of how the node score is calculated for a given set of values.
Bounded code example (external data; do not execute automatically):
```text
intel.com/foo : 2
memory: 256MB
cpu: 2
```
Bounded code example (external data; do not execute automatically):
```text
intel.com/foo : 5
memory: 1
cpu: 3
```
FunctionShapePoint {{0, 0}, {100, 10}}
Bounded code example (external data; do not execute automatically):
```text
Available:
intel.com/foo: 4
memory: 1 GB
cpu: 8
Used:
intel.com/foo: 1
memory: 256MB
cpu: 1
```
Bounded code example (external data; do not execute automatically):
```text
intel.com/foo = resourceScoringFunction((2+1),4)
= (100 - ((4-3)*100/4))
= (100 - 25)
= 75 # requested + used = 75% * available
= rawScoringFunction(75)
= 7 # floor(75/10)
memory = resourceScoringFunction((256+256),1024)
= (100 -((1024-512)*100/1024))
= 50 # requested + used = 50% * available
= rawScoringFunction(50)
= 5 # floor(50/10)
cpu = resourceScoringFunction((2+1),8)
= (100 -((8-3)*100/8))
= 37.5 # requested + used = 37.5% * available
= rawScoringFunction(37.5)
= 3 # floor(37.5/10)
NodeScore = ((7 * 5) + (5 * 1) + (3 * 3)) / (5 + 1 +
```
Bounded code example (external data; do not execute automatically):
```text
Available:
intel.com/foo: 8
memory: 1GB
cpu: 8
Used:
intel.com/foo: 2
memory: 512MB
cpu: 6
```
Bounded code example (external data; do not execute automatically): …
Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Kubernetes Documentation — content/en/docs/concepts/scheduling-eviction/resource-bin-packing.md :: Node scoring for capacity allocation ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution