@@ -3,70 +3,100 @@ reviewers:
3
3
- bsalamat
4
4
- k82cn
5
5
- ahg-g
6
- title : Resource Bin Packing for Extended Resources
6
+ title : Resource Bin Packing
7
7
content_type : concept
8
8
weight : 80
9
9
---
10
10
11
11
<!-- overview -->
12
12
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 ` .
19
15
20
16
<!-- body -->
21
17
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:
23
24
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
25
51
each resource to score nodes based on the request to capacity ratio. This
26
52
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`
31
59
parameter allows the user to tune the function as least requested or most
32
60
requested based on `utilization` and `score` values. The `resources` parameter
33
61
consists of `name` of the resource to be considered during scoring and `weight`
34
62
specify the weight of each resource.
35
63
36
64
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 .
39
67
40
68
` ` ` yaml
41
69
apiVersion: kubescheduler.config.k8s.io/v1beta3
42
70
kind: KubeSchedulerConfiguration
43
71
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
58
88
` ` `
59
89
60
90
Referencing the `KubeSchedulerConfiguration` file with the kube-scheduler
61
91
flag `--config=/path/to/config/file` will pass the configuration to the
62
92
scheduler.
63
93
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).
65
96
66
- # ## Tuning the Priority Function
97
+ # ## Tuning the score function
67
98
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.
70
100
71
101
` ` ` yaml
72
102
shape:
0 commit comments