Skip to content

Commit bc02513

Browse files
authored
Merge pull request #33748 from denkensk/update-bin-pack-doc
update the doc for bin pack scheduling
2 parents 9ac81e0 + 12b1983 commit bc02513

File tree

1 file changed

+63
-33
lines changed

1 file changed

+63
-33
lines changed

content/en/docs/concepts/scheduling-eviction/resource-bin-packing.md

Lines changed: 63 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,100 @@ reviewers:
33
- bsalamat
44
- k82cn
55
- ahg-g
6-
title: Resource Bin Packing for Extended Resources
6+
title: Resource Bin Packing
77
content_type: concept
88
weight: 80
99
---
1010

1111
<!-- overview -->
1212

13-
{{< feature-state for_k8s_version="v1.16" state="alpha" >}}
14-
15-
The kube-scheduler can be configured to enable bin packing of resources along
16-
with extended resources using `RequestedToCapacityRatioResourceAllocation`
17-
priority function. Priority functions can be used to fine-tune the
18-
kube-scheduler as per custom needs.
13+
In the [scheduling-plugin](/docs/reference/scheduling/config/#scheduling-plugins) `NodeResourcesFit` of kube-scheduler, there are two
14+
scoring strategies that support the bin packing of resources: `MostAllocated` and `RequestedToCapacityRatio`.
1915

2016
<!-- body -->
2117

22-
## Enabling Bin Packing using RequestedToCapacityRatioResourceAllocation
18+
## Enabling bin packing using MostAllocated strategy
19+
The `MostAllocated` strategy scores the nodes based on the utilization of resources, favoring the ones with higher allocation.
20+
For each resource type, you can set a weight to modify its influence in the node score.
21+
22+
To set the `MostAllocated` strategy for the `NodeResourcesFit` plugin, use a
23+
[scheduler configuration](/docs/reference/scheduling/config) similar to the following:
2324

24-
Kubernetes allows the users to specify the resources along with weights for
25+
```yaml
26+
apiVersion: kubescheduler.config.k8s.io/v1beta3
27+
kind: KubeSchedulerConfiguration
28+
profiles:
29+
- pluginConfig:
30+
- args:
31+
scoringStrategy:
32+
resources:
33+
- name: cpu
34+
weight: 1
35+
- name: memory
36+
weight: 1
37+
- name: intel.com/foo
38+
weight: 3
39+
- name: intel.com/bar
40+
weight: 3
41+
type: MostAllocated
42+
name: NodeResourcesFit
43+
```
44+
45+
To learn more about other parameters and their default configuration, see the API documentation for
46+
[`NodeResourcesFitArgs`](/docs/reference/config-api/kube-scheduler-config.v1beta3/#kubescheduler-config-k8s-io-v1beta3-NodeResourcesFitArgs).
47+
48+
## Enabling bin packing using RequestedToCapacityRatio
49+
50+
The `RequestedToCapacityRatio` strategy allows the users to specify the resources along with weights for
2551
each resource to score nodes based on the request to capacity ratio. This
2652
allows users to bin pack extended resources by using appropriate parameters
27-
and improves the utilization of scarce resources in large clusters. The
28-
behavior of the `RequestedToCapacityRatioResourceAllocation` priority function
29-
can be controlled by a configuration option called `RequestedToCapacityRatioArgs`.
30-
This argument consists of two parameters `shape` and `resources`. The `shape`
53+
to improve the utilization of scarce resources in large clusters. It favors nodes according to a
54+
configured function of the allocated resources. The behavior of the `RequestedToCapacityRatio` in
55+
the `NodeResourcesFit` score function can be controlled by the
56+
[scoringStrategy](/docs/reference/config-api/kube-scheduler-config.v1beta3/#kubescheduler-config-k8s-io-v1beta3-ScoringStrategy) field.
57+
Within the `scoringStrategy` field, you can configure two parameters: `requestedToCapacityRatioParam` and
58+
`resources`. The `shape` in `requestedToCapacityRatioParam`
3159
parameter allows the user to tune the function as least requested or most
3260
requested based on `utilization` and `score` values. The `resources` parameter
3361
consists of `name` of the resource to be considered during scoring and `weight`
3462
specify the weight of each resource.
3563

3664
Below is an example configuration that sets
37-
`requestedToCapacityRatioArguments` to bin packing behavior for extended
38-
resources `intel.com/foo` and `intel.com/bar`.
65+
the bin packing behavior for extended resources `intel.com/foo` and `intel.com/bar`
66+
using the `requestedToCapacityRatio` field.
3967

4068
```yaml
4169
apiVersion: kubescheduler.config.k8s.io/v1beta3
4270
kind: KubeSchedulerConfiguration
4371
profiles:
44-
# ...
45-
pluginConfig:
46-
- name: RequestedToCapacityRatio
47-
args:
48-
shape:
49-
- utilization: 0
50-
score: 10
51-
- utilization: 100
52-
score: 0
53-
resources:
54-
- name: intel.com/foo
55-
weight: 3
56-
- name: intel.com/bar
57-
weight: 5
72+
- pluginConfig:
73+
- args:
74+
scoringStrategy:
75+
resources:
76+
- name: intel.com/foo
77+
weight: 3
78+
- name: intel.com/bar
79+
weight: 3
80+
requestedToCapacityRatioParam:
81+
shape:
82+
- utilization: 0
83+
score: 0
84+
- utilization: 100
85+
score: 10
86+
type: RequestedToCapacityRatio
87+
name: NodeResourcesFit
5888
```
5989

6090
Referencing the `KubeSchedulerConfiguration` file with the kube-scheduler
6191
flag `--config=/path/to/config/file` will pass the configuration to the
6292
scheduler.
6393

64-
**This feature is disabled by default**
94+
To learn more about other parameters and their default configuration, see the API documentation for
95+
[`NodeResourcesFitArgs`](/docs/reference/config-api/kube-scheduler-config.v1beta3/#kubescheduler-config-k8s-io-v1beta3-NodeResourcesFitArgs).
6596

66-
### Tuning the Priority Function
97+
### Tuning the score function
6798

68-
`shape` is used to specify the behavior of the
69-
`RequestedToCapacityRatioPriority` function.
99+
`shape` is used to specify the behavior of the `RequestedToCapacityRatio` function.
70100

71101
```yaml
72102
shape:

0 commit comments

Comments
 (0)