Interview Prep/AWS/EKS in Production

How do you spread workloads correctly across AZs on EKS?

IntermediateProductionEKS in Production
Answer

Use topology spread constraints, not just anti-affinity:

topologySpreadConstraints:
  - maxSkew: 1
    topologyKey: topology.kubernetes.io/zone
    whenUnsatisfiable: DoNotSchedule
    labelSelector: {matchLabels: {app: orders-api}}

Make sure the node provisioner can launch in all AZs (Karpenter respects the constraint when launching). For EBS-backed StatefulSets, volumes are AZ-bound, so use WaitForFirstConsumer storage classes and one replica per AZ.

aws All AWS questions Roadmap: EKS, ECS & serverless on AWS

More on EKS in Production