Update URLs in scheduler.md with correct folder path (#6198)

* Update URLs in scheduler.md with correct folder path

The `generic_scheduler.go` is moved under `scheduler` folder, not `scheduler/core` folder. This commit updated the description & the link to code file.
Note that `legacy_registry.go` is removed as well in master branch. We may need to fix the link and description as well after release.

* #6198 Updated scheduler part in contributors/devel/README.md, adding few doc links. Removed scheduler.md

* #6198 Removed 'Scheduler extensibility' part in scheduling_code_hierarchy_overview; removed scheduler framework plugins link in devel README
This commit is contained in:
Jiekun 2021-11-09 07:12:50 +08:00 committed by GitHub
parent d661ed1c8c
commit 51c8f51900
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 90 deletions

View File

@ -117,10 +117,12 @@ See the [kubernetes/release](https://github.com/kubernetes/release) repository f
### SIG Scheduling
* **Understanding the Kubernetes Scheduler** [scheduler.md](sig-scheduling/scheduler.md)
* **Understanding the Kubernetes Scheduler** [scheduling_code_hierarchy_overview.md](sig-scheduling/scheduling_code_hierarchy_overview.md)
* **Scheduler Algorithm in Kubernetes** [scheduler_algorithm.md](sig-scheduling/scheduler_algorithm.md)
* **Understanding how Pods are queued in Kubernetes Scheduler** [scheduler_queues.md](sig-scheduling/scheduler_queues.md)
* **Scheduler Benchmarking** [scheduler_benchmarking.md](sig-scheduling/scheduler_benchmarking.md)
### SIG Architecture

View File

@ -1,89 +0,0 @@
# Understanding the Kubernetes Scheduler
The Kubernetes scheduler runs as a process alongside the other master components such as the API server.
Its interface to the API server is to watch for Pods with an empty `PodSpec.NodeName`,
and for each Pod, it posts a binding indicating where the Pod should be scheduled.
## Exploring the code
We are dividing scheduler into three layers from high level:
- [cmd/kube-scheduler/scheduler.go](http://releases.k8s.io/HEAD/cmd/kube-scheduler/scheduler.go):
This is the main() entry that does initialization before calling the scheduler framework.
- [pkg/scheduler/scheduler.go](http://releases.k8s.io/HEAD/pkg/scheduler/scheduler.go):
This is the scheduler framework that handles stuff (e.g. binding) beyond the scheduling algorithm.
- [pkg/scheduler/core/generic_scheduler.go](http://releases.k8s.io/HEAD/pkg/scheduler/core/generic_scheduler.go):
The scheduling algorithm that assigns nodes for pods.
## The scheduling algorithm
```
For given pod:
+---------------------------------------------+
| Schedulable nodes: |
| |
| +--------+ +--------+ +--------+ |
| | node 1 | | node 2 | | node 3 | |
| +--------+ +--------+ +--------+ |
| |
+-------------------+-------------------------+
|
|
v
+-------------------+-------------------------+
Pred. filters: node 3 doesn't have enough resource
+-------------------+-------------------------+
|
|
v
+-------------------+-------------------------+
| remaining nodes: |
| +--------+ +--------+ |
| | node 1 | | node 2 | |
| +--------+ +--------+ |
| |
+-------------------+-------------------------+
|
|
v
+-------------------+-------------------------+
Priority function: node 1: p=2
node 2: p=5
+-------------------+-------------------------+
|
|
v
select max{node priority} = node 2
```
The Scheduler tries to find a node for each Pod, one at a time.
- First it applies a set of "predicates" to filter out inappropriate nodes. For example, if the PodSpec specifies resource requests, then the scheduler will filter out nodes that don't have at least that much resources available (computed as the capacity of the node minus the sum of the resource requests of the containers that are already running on the node).
- Second, it applies a set of "priority functions" that rank the nodes that weren't filtered out by the predicate check. For example, it tries to spread Pods across nodes and zones while at the same time favoring the least (theoretically) loaded nodes (where "load" - in theory - is measured as the sum of the resource requests of the containers running on the node, divided by the node's capacity).
- Finally, the node with the highest priority is chosen (or, if there are multiple such nodes, then one of them is chosen at random). The code for this main scheduling loop is in the function `Schedule()` in [pkg/scheduler/core/generic_scheduler.go](http://releases.k8s.io/HEAD/pkg/scheduler/core/generic_scheduler.go).
### Predicates and priorities policies
- Predicates are a set of policies applied one by one to filter out inappropriate nodes.
- Priorities are a set of policies applied one by one to rank nodes (that made it through the filter of the predicates).
- By default, Kubernetes provides built-in predicates and priorities policies documented in [scheduler_algorithm.md](scheduler_algorithm.md).
- The predicates and priorities code are defined in [pkg/scheduler/framework/plugins/legacy_registry.go].
## Scheduler extensibility
The scheduler is extensible: the cluster administrator can choose which of the pre-defined scheduling policies to apply, and can add new ones.
### Modifying policies
The policies that are applied when scheduling can be chosen in one of two ways.
The default policies used are selected by the fields `DefaultPredicates` and `DefaultPriorities` in
[pkg/scheduler/framework/plugins/legacy_registry.go]. 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](https://git.k8s.io/examples/staging/scheduler-policy/scheduler-policy-config.json) for an example
config file. (Note that the config file format is versioned; the API is defined in [pkg/scheduler/apis](http://releases.k8s.io/HEAD/pkg/scheduler/apis/)).
Thus to add a new scheduling policy, you should:
1. Modify the available predicates or add to the priorities, both which are present in [pkg/scheduler/framework/plugins/legacy_registry.go].
2. Either register the policy in `DefaultPredicates` or `DefaultPriorities` both of which can be found in [pkg/scheduler/framework/plugins/legacy_registry.go], or use a policy config file.
[pkg/scheduler/framework/plugins/legacy_registry.go]: https://releases.k8s.io/HEAD/pkg/scheduler/framework/plugins/legacy_registry.go