Skip to content

Commit e9bba2e

Browse files
authored
Update 2017-09-25-Kubernetes-Scheduler.md
1 parent 3d7d602 commit e9bba2e

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

post/2017-09-25-Kubernetes-Scheduler.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#### Kubernetes Scheduler
1+
# Kubernetes Scheduler
22

3-
##### 1. Scheduler Introducation
3+
## 1. Scheduler Introducation
44

55
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.
66

77
![](../images/2017-09-25-Kubernetes-Scheduler/Scheduler.png)
88

9-
##### 2. Scheduler Workflow
9+
## 2. Scheduler Workflow
1010

1111
The Kubernetes Scheduler is focused on scheduling pods into specified work nodes by schedule algorithm, which also be called ```Bind```.The input of Scheduler is the pods which need to be scheduled and the nodes which could be scheduled into, and the output of Scheduler is ```Bind``` which connects between pods and nodes.
1212

@@ -19,7 +19,7 @@ The Kubernetes Scheduler tries to find a node for each Pod, one at a time.
1919

2020
![](../images/2017-09-25-Kubernetes-Scheduler/Algorithm.png)
2121

22-
##### 3. Scheduler Code Analysis
22+
## 3. Scheduler Code Analysis
2323

2424
Scheduler main implementations include ```plugin/cmd/kube-scheduler``` and ```plugin/pkg/scheduler```.
2525
- ```plugin/cmd/kube-scheduler``` starts the Scheduler process and reads the configurations from Command Line Interface and so on.
@@ -29,7 +29,7 @@ Scheduler main implementations include ```plugin/cmd/kube-scheduler``` and ```pl
2929
- ```plugin/pkg/scheduler/scheduler.go``` is the main class of Scheduler.
3030
- ```plugin/pkg/scheduler/core/generic_scheduler.go``` invokes the detail scheduling algorithm.
3131

32-
- The entrance of Scheduler is ```plugin/cmd/kube-scheduler/scheduler.go```.
32+
The entrance of Scheduler is ```plugin/cmd/kube-scheduler/scheduler.go```.
3333
- First Scheduler creates ```configFactory``` and then creates ```config```.
3434
- If it specifies policy-config-file, Scheduler will create ```config``` by policy-config-file(CreateFromConfig),
3535
- If not, Scheduler will create ```config``` by Scheduler algorithm providers(CreateFromProvider),
@@ -68,76 +68,76 @@ The Kubernetes Scheduler is able to find the most fit node for pods. The actual
6868
"hardPodAffinitySymmetricWeight" : 10
6969
}
7070

71-
##### 4. Scheduler Algorithm
71+
## 4. Scheduler Algorithm
7272

73-
###### 4.1 Default Predicates
73+
### 4.1 Default Predicates
7474

75-
####### 4.1.1 NoVolumeZoneConflict
75+
#### 4.1.1 NoVolumeZoneConflict
7676

7777
Evaluate if the volumes a pod requests are available on the node, given the Zone restrictions.
7878

79-
####### 4.1.2 MaxEBSVolumeCount
79+
#### 4.1.2 MaxEBSVolumeCount
8080
Ensure that the number of attached ElasticBlockStore volumes does not exceed a maximum value (by default, 39, since Amazon recommends a maximum of 40 with one of those 40 reserved for the root volume -- see Amazon's documentation). The maximum value can be controlled by setting the KUBE_MAX_PD_VOLS environment variable.
8181

82-
####### 4.1.3 MaxGCEPDVolumeCount
82+
#### 4.1.3 MaxGCEPDVolumeCount
8383
Ensure that the number of attached GCE PersistentDisk volumes does not exceed a maximum value (by default, 16, which is the maximum GCE allows -- see GCE's documentation). The maximum value can be controlled by setting the KUBE_MAX_PD_VOLS environment variable.
8484

85-
####### 4.1.4 MaxAzureDiskVolumeCount
85+
#### 4.1.4 MaxAzureDiskVolumeCount
8686
Ensure that the number of attached Azure volumes does not exceed a maximum value (by default, 16).
8787

88-
####### 4.1.5 MatchInterPodAffinity
88+
#### 4.1.5 MatchInterPodAffinity
8989
Fit is determined by inter-pod affinity. AffinityAnnotationKey represents the key of affinity data (json serialized) in the Annotations of a Pod.
9090

91-
####### 4.1.6 NoDiskConflict
91+
#### 4.1.6 NoDiskConflict
9292
Evaluate if a pod can fit due to the volumes it requests, and those that are already mounted. Currently supported volumes are: AWS EBS, GCE PD, ISCSI and Ceph RBD. Only Persistent Volume Claims for those supported types are checked. Persistent Volumes added directly to pods are not evaluated and are not constrained by this policy.
9393

94-
####### 4.1.7 GeneralPredicates
95-
(1) PodFitsResources
94+
#### 4.1.7 GeneralPredicates
95+
##### PodFitsResources
9696
Check if the free resource (CPU and Memory) meets the requirement of the Pod. The free resource is measured by the capacity minus the sum of requests of all Pods on the node. To learn more about the resource QoS in Kubernetes, please check QoS proposal.
9797

98-
(2) PodFitsHost
98+
##### PodFitsHost
9999
Filter out all nodes except the one specified in the PodSpec's NodeName field.
100100

101-
(3) PodFitsHostPorts
101+
##### PodFitsHostPorts
102102
Check if any HostPort required by the Pod is already occupied on the node.
103103

104-
(4) PodMatchNodeSelector
104+
##### PodMatchNodeSelector
105105
PodMatchNodeSelector checks if a pod node selector matches the node label.
106106

107-
####### 4.1.8 CheckNodeMemoryPressure
107+
#### 4.1.8 CheckNodeMemoryPressure
108108
Check if a pod can be scheduled on a node reporting memory pressure condition. Currently, no BestEffort should be placed on a node under memory pressure as it gets automatically evicted by kubelet.
109109

110-
####### 4.1.9 CheckNodeDiskPressure
110+
#### 4.1.9 CheckNodeDiskPressure
111111
Check if a pod can be scheduled on a node reporting disk pressure condition. Currently, no pods should be placed on a node under disk pressure as it gets automatically evicted by kubelet.
112112

113-
####### 4.1.10 NoVolumeNodeConflict
113+
#### 4.1.10 NoVolumeNodeConflict
114114
Fit is determined by volume zone requirements.
115115

116-
####### 4.1.11 PodToleratesNodeTaints
116+
#### 4.1.11 PodToleratesNodeTaints
117117
Fit is determined based on whether a pod can tolerate all of the node's taints.
118118

119-
###### 4.2 Default Priorities
119+
### 4.2 Default Priorities
120120
```FinalScoreNode = (Weight1 * priorityFunc1) + (Weight2 * priorityFunc2) + ... + (Weightn * priorityFuncn)```
121121

122-
####### 4.2.1 SelectorSpreadPriority
122+
#### 4.2.1 SelectorSpreadPriority
123123
Spread Pods by minimizing the number of Pods belonging to the same service, replication controller, or replica set on the same node. If zone information is present on the nodes, the priority will be adjusted so that pods are spread across zones and nodes.
124124

125-
####### 4.2.2 InterPodAffinityPriority
125+
#### 4.2.2 InterPodAffinityPriority
126126
Pods should be placed in the same topological domain (e.g. same node, same rack, same zone, same power domain, etc.)
127127
as some other pods, or, conversely, should not be placed in the same topological domain as some other pods.
128128

129-
####### 4.2.3 LeastRequestedPriority
129+
#### 4.2.3 LeastRequestedPriority
130130
The node is prioritized based on the fraction of the node that would be free if the new Pod were scheduled onto the node. (In other words, (capacity - sum of requests of all Pods already on the node - request of Pod that is being scheduled) / capacity). CPU and memory are equally weighted. The node with the highest free fraction is the most preferred. Note that this priority function has the effect of spreading Pods across the nodes with respect to resource consumption.
131131

132-
####### 4.2.4 BalancedResourceAllocation
132+
#### 4.2.4 BalancedResourceAllocation
133133
This priority function tries to put the Pod on a node such that the CPU and Memory utilization rate is balanced after the Pod is deployed.
134134
score = 10 - abs(cpuFraction - memoryFraction) * 10
135135

136-
####### 4.2.5 NodePreferAvoidPodsPriority
136+
#### 4.2.5 NodePreferAvoidPodsPriority
137137
Set this weight large enough to override all other priority functions. The default weight is 100000.
138138

139-
####### 4.2.6 NodeAffinityPriority
139+
#### 4.2.6 NodeAffinityPriority
140140
Implements ```preferresDuringSchedulingIngnoredDuringExecution``` node affinity.
141141

142-
####### 4.2.7 TaintTolerationPriority
142+
#### 4.2.7 TaintTolerationPriority
143143
Prioritizes nodes that marked with taint which pod can tolerate.

0 commit comments

Comments
 (0)