The environment is in production. I have 156 GKE Node worker in a cluster. And I wanna sign 1 (max) nginx pod to 1 node. It means, I must be using PodAntiAffinity.
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: project
operator: In
values:
- nginx-web
topologyKey: kubernetes.io/hostname
When I tested this in my staging environment, the result is expected.
My staging GKE cluster is High Availability (Zonal) it means worker nodes deployed to A, B, and C zone.
Will the PodAntiAffinity
with "required" model spread the pod to A, B, C zone or it's automatically controlled by CloudProvider (GKE) ?
I am just curious how it works behind
I need some suggestions from your probably you have experienced on this.
==============================
Second try
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: project
operator: In
values:
- ingress-web
topologyKey: topology.kubernetes.io/zone
weight: 100
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: project
operator: In
values:
- nginx-web
topologyKey: kubernetes.io/hostname