You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The scheduling algorithm that assigns nodes for pods.
16
+
17
+
## The scheduling algorithm
9
18
10
19
```
11
-
+-------+
12
-
+---------------+ node 1|
13
-
| +-------+
14
-
|
15
-
+----> | Apply pred. filters
16
-
| |
17
-
| | +-------+
18
-
| +----+---------->+node 2 |
19
-
| | +--+----+
20
-
| watch | |
21
-
| | | +------+
22
-
| +---------------------->+node 3|
23
-
+--+---------------+ | +--+---+
24
-
| Pods in apiserver| | |
25
-
+------------------+ | |
26
-
| |
27
-
| |
28
-
+------------V------v--------+
29
-
| Priority function |
30
-
+-------------+--------------+
31
-
|
32
-
| node 1: p=2
33
-
| node 2: p=5
34
-
v
35
-
select max{node priority} = node 2
20
+
For given pod:
21
+
22
+
+---------------------------------------------+
23
+
| Schedulable nodes: |
24
+
| |
25
+
| +--------+ +--------+ +--------+ |
26
+
| | node 1 | | node 2 | | node 3 | |
27
+
| +--------+ +--------+ +--------+ |
28
+
| |
29
+
+-------------------+-------------------------+
30
+
|
31
+
|
32
+
v
33
+
+-------------------+-------------------------+
34
+
35
+
Pred. filters: node 3 doesn't have enough resource
36
+
37
+
+-------------------+-------------------------+
38
+
|
39
+
|
40
+
v
41
+
+-------------------+-------------------------+
42
+
| remaining nodes: |
43
+
| +--------+ +--------+ |
44
+
| | node 1 | | node 2 | |
45
+
| +--------+ +--------+ |
46
+
| |
47
+
+-------------------+-------------------------+
48
+
|
49
+
|
50
+
v
51
+
+-------------------+-------------------------+
36
52
53
+
Priority function: node 1: p=2
54
+
node 2: p=5
55
+
56
+
+-------------------+-------------------------+
57
+
|
58
+
|
59
+
v
60
+
select max{node priority} = node 2
37
61
```
38
62
39
63
The Scheduler tries to find a node for each Pod, one at a time.
@@ -60,12 +84,6 @@ the policies used are selected by the functions `defaultPredicates()` and `defau
60
84
However, the choice of policies can be overridden by passing the command-line flag `--policy-config-file` to the scheduler, pointing to a JSON file specifying which scheduling policies to use. See [examples/scheduler-policy-config.json](../../examples/scheduler-policy-config.json) for an example
61
85
config file. (Note that the config file format is versioned; the API is defined in [plugin/pkg/scheduler/api](http://releases.k8s.io/HEAD/plugin/pkg/scheduler/api/)).
62
86
Thus to add a new scheduling policy, you should modify [plugin/pkg/scheduler/algorithm/predicates/predicates.go] (http://releases.k8s.io/HEAD/plugin/pkg/scheduler/algorithm/predicates/predicates.go) or add to the directory [plugin/pkg/scheduler/algorithm/priorities](http://releases.k8s.io/HEAD/plugin/pkg/scheduler/algorithm/priorities/), and either register the policy in `defaultPredicates()` or `defaultPriorities()`, or use a policy config file.
63
-
64
-
## Exploring the code
65
-
66
-
If you want to get a global picture of how the scheduler works, you can start in
0 commit comments