<p>I deployed a K8s <strong>StatefulSet</strong> with 30 replicas (or N replicas, where N is multiple of 3) in EKS Cluster.</p>
<p>EKS cluster is with 3 nodes, one node for one AZ, and I want to <em>guarantee</em> with Kubernetes Affinity/AntiAffinity the <strong>equal</strong> distribution of pods across different AZ.</p>
<pre><code>us-west-2a (n nodes) -&gt; N/3 pods
us-west-2b (m nodes) -&gt; N/3 pods
us-west-2c (o nodes) -&gt; N/3 pods
</code></pre>
<p>Thanks</p>

<p>While this is too possible with node affinity, a straight forward way is the use of topologySpreadContraints, here's the k8s <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/#api" rel="nofollow noreferrer">documentation, diagrams and examples</a> to see it in action.</p>
