kubernetes-hands-on/13-affinity-anti-affinity/01-pod-anti-affinity.yml

43 lines
964 B
YAML
Raw Normal View History

---
apiVersion: v1
kind: Pod
metadata:
name: nginx-pod-anti-affinity1
labels:
run: nginx-pod-anti-affinity
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: run
operator: In
values:
- nginx-pod-anti-affinity
topologyKey: kubernetes.io/hostname
containers:
2019-05-14 22:04:12 +06:00
- name: nginx
image: nginx
---
apiVersion: v1
kind: Pod
metadata:
name: nginx-pod-anti-affinity2
labels:
run: nginx-pod-anti-affinity
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: run
operator: In
values:
- nginx-pod-anti-affinity
topologyKey: kubernetes.io/hostname
containers:
2019-05-14 22:04:12 +06:00
- name: nginx
image: nginx