Skip to content

Commit 28dd20b

Browse files
authored
Merge pull request #50903 from jayeshmahajan/pods-with
[hi] add example Pods-with*
2 parents 9216674 + a0ac9c0 commit 28dd20b

6 files changed

+121
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: with-affinity-preferred-weight
5+
spec:
6+
affinity:
7+
nodeAffinity:
8+
requiredDuringSchedulingIgnoredDuringExecution:
9+
nodeSelectorTerms:
10+
- matchExpressions:
11+
- key: kubernetes.io/os
12+
operator: In
13+
values:
14+
- linux
15+
preferredDuringSchedulingIgnoredDuringExecution:
16+
- weight: 1
17+
preference:
18+
matchExpressions:
19+
- key: label-1
20+
operator: In
21+
values:
22+
- key-1
23+
- weight: 50
24+
preference:
25+
matchExpressions:
26+
- key: label-2
27+
operator: In
28+
values:
29+
- key-2
30+
containers:
31+
- name: with-node-affinity
32+
image: registry.k8s.io/pause:3.8
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: with-node-affinity
5+
spec:
6+
affinity:
7+
nodeAffinity:
8+
requiredDuringSchedulingIgnoredDuringExecution:
9+
nodeSelectorTerms:
10+
- matchExpressions:
11+
- key: topology.kubernetes.io/zone
12+
operator: In
13+
values:
14+
- antarctica-east1
15+
- antarctica-west1
16+
preferredDuringSchedulingIgnoredDuringExecution:
17+
- weight: 1
18+
preference:
19+
matchExpressions:
20+
- key: another-node-label-key
21+
operator: In
22+
values:
23+
- another-node-label-value
24+
containers:
25+
- name: with-node-affinity
26+
image: registry.k8s.io/pause:3.8
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: with-pod-affinity
5+
spec:
6+
affinity:
7+
podAffinity:
8+
requiredDuringSchedulingIgnoredDuringExecution:
9+
- labelSelector:
10+
matchExpressions:
11+
- key: security
12+
operator: In
13+
values:
14+
- S1
15+
topologyKey: topology.kubernetes.io/zone
16+
podAntiAffinity:
17+
preferredDuringSchedulingIgnoredDuringExecution:
18+
- weight: 100
19+
podAffinityTerm:
20+
labelSelector:
21+
matchExpressions:
22+
- key: security
23+
operator: In
24+
values:
25+
- S2
26+
topologyKey: topology.kubernetes.io/zone
27+
containers:
28+
- name: with-pod-affinity
29+
image: registry.k8s.io/pause:3.8
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: test-pod
5+
spec:
6+
schedulingGates:
7+
- name: example.com/foo
8+
- name: example.com/bar
9+
containers:
10+
- name: pause
11+
image: registry.k8s.io/pause:3.6
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: nginx
5+
labels:
6+
env: test
7+
spec:
8+
containers:
9+
- name: nginx
10+
image: nginx
11+
imagePullPolicy: IfNotPresent
12+
tolerations:
13+
- key: "example-key"
14+
operator: "Exists"
15+
effect: "NoSchedule"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: test-pod
5+
spec:
6+
containers:
7+
- name: pause
8+
image: registry.k8s.io/pause:3.6

0 commit comments

Comments
 (0)