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
Copy file name to clipboardExpand all lines: content/en/blog/_posts/2017-03-00-Advanced-Scheduling-In-Kubernetes.md
+30-73Lines changed: 30 additions & 73 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,21 +20,14 @@ For example, if we want to require scheduling on a node that is in the us-centra
20
20
21
21
22
22
```
23
-
affinity:
24
-
25
-
nodeAffinity:
26
-
27
-
requiredDuringSchedulingIgnoredDuringExecution:
28
-
29
-
nodeSelectorTerms:
30
-
31
-
- matchExpressions:
32
-
33
-
- key: "failure-domain.beta.kubernetes.io/zone"
34
-
35
-
operator: In
36
-
37
-
values: ["us-central1-a"]
23
+
affinity:
24
+
nodeAffinity:
25
+
requiredDuringSchedulingIgnoredDuringExecution:
26
+
nodeSelectorTerms:
27
+
- matchExpressions:
28
+
- key: "failure-domain.beta.kubernetes.io/zone"
29
+
operator: In
30
+
values: ["us-central1-a"]
38
31
```
39
32
40
33
@@ -44,21 +37,14 @@ Preferred rules mean that if nodes match the rules, they will be chosen first, a
44
37
45
38
46
39
```
47
-
affinity:
48
-
49
-
nodeAffinity:
50
-
51
-
preferredDuringSchedulingIgnoredDuringExecution:
52
-
53
-
nodeSelectorTerms:
54
-
55
-
- matchExpressions:
56
-
57
-
- key: "failure-domain.beta.kubernetes.io/zone"
58
-
59
-
operator: In
60
-
61
-
values: ["us-central1-a"]
40
+
affinity:
41
+
nodeAffinity:
42
+
preferredDuringSchedulingIgnoredDuringExecution:
43
+
nodeSelectorTerms:
44
+
- matchExpressions:
45
+
- key: "failure-domain.beta.kubernetes.io/zone"
46
+
operator: In
47
+
values: ["us-central1-a"]
62
48
```
63
49
64
50
@@ -67,21 +53,14 @@ Node anti-affinity can be achieved by using negative operators. So for instance
67
53
68
54
69
55
```
70
-
affinity:
71
-
72
-
nodeAffinity:
73
-
74
-
requiredDuringSchedulingIgnoredDuringExecution:
75
-
76
-
nodeSelectorTerms:
77
-
78
-
- matchExpressions:
79
-
80
-
- key: "failure-domain.beta.kubernetes.io/zone"
81
-
82
-
operator: NotIn
83
-
84
-
values: ["us-central1-a"]
56
+
affinity:
57
+
nodeAffinity:
58
+
requiredDuringSchedulingIgnoredDuringExecution:
59
+
nodeSelectorTerms:
60
+
- matchExpressions:
61
+
- key: "failure-domain.beta.kubernetes.io/zone"
62
+
operator: NotIn
63
+
values: ["us-central1-a"]
85
64
```
86
65
87
66
@@ -99,23 +78,19 @@ The kubectl command allows you to set taints on nodes, for example:
99
78
100
79
```
101
80
kubectl taint nodes node1 key=value:NoSchedule
102
-
```
81
+
```
103
82
104
83
105
84
creates a taint that marks the node as unschedulable by any pods that do not have a toleration for taint with key key, value value, and effect NoSchedule. (The other taint effects are PreferNoSchedule, which is the preferred version of NoSchedule, and NoExecute, which means any pods that are running on the node when the taint is applied will be evicted unless they tolerate the taint.) The toleration you would add to a PodSpec to have the corresponding pod tolerate this taint would look like this
106
85
107
86
108
87
109
88
```
110
-
tolerations:
111
-
112
-
- key: "key"
113
-
114
-
operator: "Equal"
115
-
116
-
value: "value"
117
-
118
-
effect: "NoSchedule"
89
+
tolerations:
90
+
- key: "key"
91
+
operator: "Equal"
92
+
value: "value"
93
+
effect: "NoSchedule"
119
94
```
120
95
121
96
@@ -138,21 +113,13 @@ Let’s look at an example. Say you have front-ends in service S1, and they comm
0 commit comments