fix(advanced-scheduling): space fixes
as the CKA requires taking these code snippets and using them quickly, spaces can be an issue add two spaces to begin of line to make pod spec copying even faster (if this is the case)pull/25955/head
parent
852024cffd
commit
ce86bac08f
|
@ -21,19 +21,12 @@ For example, if we want to require scheduling on a node that is in the us-centra
|
||||||
|
|
||||||
```
|
```
|
||||||
affinity:
|
affinity:
|
||||||
|
|
||||||
nodeAffinity:
|
nodeAffinity:
|
||||||
|
|
||||||
requiredDuringSchedulingIgnoredDuringExecution:
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
|
||||||
nodeSelectorTerms:
|
nodeSelectorTerms:
|
||||||
|
|
||||||
- matchExpressions:
|
- matchExpressions:
|
||||||
|
|
||||||
- key: "failure-domain.beta.kubernetes.io/zone"
|
- key: "failure-domain.beta.kubernetes.io/zone"
|
||||||
|
|
||||||
operator: In
|
operator: In
|
||||||
|
|
||||||
values: ["us-central1-a"]
|
values: ["us-central1-a"]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -45,19 +38,12 @@ Preferred rules mean that if nodes match the rules, they will be chosen first, a
|
||||||
|
|
||||||
```
|
```
|
||||||
affinity:
|
affinity:
|
||||||
|
|
||||||
nodeAffinity:
|
nodeAffinity:
|
||||||
|
|
||||||
preferredDuringSchedulingIgnoredDuringExecution:
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
|
||||||
nodeSelectorTerms:
|
nodeSelectorTerms:
|
||||||
|
|
||||||
- matchExpressions:
|
- matchExpressions:
|
||||||
|
|
||||||
- key: "failure-domain.beta.kubernetes.io/zone"
|
- key: "failure-domain.beta.kubernetes.io/zone"
|
||||||
|
|
||||||
operator: In
|
operator: In
|
||||||
|
|
||||||
values: ["us-central1-a"]
|
values: ["us-central1-a"]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -68,19 +54,12 @@ Node anti-affinity can be achieved by using negative operators. So for instance
|
||||||
|
|
||||||
```
|
```
|
||||||
affinity:
|
affinity:
|
||||||
|
|
||||||
nodeAffinity:
|
nodeAffinity:
|
||||||
|
|
||||||
requiredDuringSchedulingIgnoredDuringExecution:
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
|
||||||
nodeSelectorTerms:
|
nodeSelectorTerms:
|
||||||
|
|
||||||
- matchExpressions:
|
- matchExpressions:
|
||||||
|
|
||||||
- key: "failure-domain.beta.kubernetes.io/zone"
|
- key: "failure-domain.beta.kubernetes.io/zone"
|
||||||
|
|
||||||
operator: NotIn
|
operator: NotIn
|
||||||
|
|
||||||
values: ["us-central1-a"]
|
values: ["us-central1-a"]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -108,13 +87,9 @@ creates a taint that marks the node as unschedulable by any pods that do not hav
|
||||||
|
|
||||||
```
|
```
|
||||||
tolerations:
|
tolerations:
|
||||||
|
|
||||||
- key: "key"
|
- key: "key"
|
||||||
|
|
||||||
operator: "Equal"
|
operator: "Equal"
|
||||||
|
|
||||||
value: "value"
|
value: "value"
|
||||||
|
|
||||||
effect: "NoSchedule"
|
effect: "NoSchedule"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -138,21 +113,13 @@ Let’s look at an example. Say you have front-ends in service S1, and they comm
|
||||||
|
|
||||||
```
|
```
|
||||||
affinity:
|
affinity:
|
||||||
|
|
||||||
podAffinity:
|
podAffinity:
|
||||||
|
|
||||||
requiredDuringSchedulingIgnoredDuringExecution:
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
|
||||||
- labelSelector:
|
- labelSelector:
|
||||||
|
|
||||||
matchExpressions:
|
matchExpressions:
|
||||||
|
|
||||||
- key: service
|
- key: service
|
||||||
|
|
||||||
operator: In
|
operator: In
|
||||||
|
|
||||||
values: [“S1”]
|
values: [“S1”]
|
||||||
|
|
||||||
topologyKey: failure-domain.beta.kubernetes.io/zone
|
topologyKey: failure-domain.beta.kubernetes.io/zone
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -172,25 +139,15 @@ Here we have a Pod where we specify the schedulerName field:
|
||||||
|
|
||||||
```
|
```
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
|
||||||
kind: Pod
|
kind: Pod
|
||||||
|
|
||||||
metadata:
|
metadata:
|
||||||
|
|
||||||
name: nginx
|
name: nginx
|
||||||
|
|
||||||
labels:
|
labels:
|
||||||
|
|
||||||
app: nginx
|
app: nginx
|
||||||
|
|
||||||
spec:
|
spec:
|
||||||
|
|
||||||
schedulerName: my-scheduler
|
schedulerName: my-scheduler
|
||||||
|
|
||||||
containers:
|
containers:
|
||||||
|
|
||||||
- name: nginx
|
- name: nginx
|
||||||
|
|
||||||
image: nginx:1.10
|
image: nginx:1.10
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue