Skip to content

Commit 5b28c54

Browse files
authored
Merge pull request #25955 from georgettica/patch-1
fix(advanced-scheduling): space fixes
2 parents aef9369 + ce86bac commit 5b28c54

File tree

1 file changed

+30
-73
lines changed

1 file changed

+30
-73
lines changed

content/en/blog/_posts/2017-03-00-Advanced-Scheduling-In-Kubernetes.md

Lines changed: 30 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,14 @@ For example, if we want to require scheduling on a node that is in the us-centra
2020

2121

2222
```
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"]
3831
```
3932

4033

@@ -44,21 +37,14 @@ Preferred rules mean that if nodes match the rules, they will be chosen first, a
4437

4538

4639
```
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"]
6248
```
6349

6450

@@ -67,21 +53,14 @@ Node anti-affinity can be achieved by using negative operators. So for instance
6753

6854

6955
```
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"]
8564
```
8665

8766

@@ -99,23 +78,19 @@ The kubectl command allows you to set taints on nodes, for example:
9978

10079
```
10180
kubectl taint nodes node1 key=value:NoSchedule
102-
```
81+
```
10382

10483

10584
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
10685

10786

10887

10988
```
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"
11994
```
12095

12196

@@ -138,21 +113,13 @@ Let’s look at an example. Say you have front-ends in service S1, and they comm
138113

139114
```
140115
affinity:
141-
142116
podAffinity:
143-
144117
requiredDuringSchedulingIgnoredDuringExecution:
145-
146118
- labelSelector:
147-
148119
matchExpressions:
149-
150120
- key: service
151-
152121
operator: In
153-
154122
values: [“S1”]
155-
156123
topologyKey: failure-domain.beta.kubernetes.io/zone
157124
```
158125

@@ -172,25 +139,15 @@ Here we have a Pod where we specify the schedulerName field:
172139

173140
```
174141
apiVersion: v1
175-
176142
kind: Pod
177-
178143
metadata:
179-
180144
name: nginx
181-
182145
labels:
183-
184146
app: nginx
185-
186147
spec:
187-
188148
schedulerName: my-scheduler
189-
190149
containers:
191-
192150
- name: nginx
193-
194151
image: nginx:1.10
195152
```
196153

0 commit comments

Comments
 (0)