<p>I'm in the process of creating fargate profiles for my AWS EKS cluster using terraform. In <a href="https://github.com/terraform-aws-modules/terraform-aws-eks/blob/v19.5.1/examples/karpenter/main.tf#L114" rel="nofollow noreferrer">this example</a> for the Terraform Karpenter module, they have a loop that creates one profile for each of the 3 availability zones used in the example:</p>
<pre><code>
  fargate_profiles = { 
    for i in range(3) :
      &quot;karpenter-${element(split(&quot;-&quot;, local.azs[i]), 2)}&quot; =&gt; {
        selectors = [
          { namespace = &quot;karpenter&quot; }
        ]
        # We want to create a profile per AZ for high availability
        subnet_ids = [element(module.vpc.private_subnets, i)]
      }
  }
  
</code></pre>
<p>Why is this necessary? What's the difference between this and creating a single profile that is attached to 3 zones? Something like this:</p>
<pre><code>  fargate_profiles = {
    &quot;karpenter&quot; = {
      selectors = [
        { namespace = &quot;karpenter&quot; }
      ]
      subnet_ids = var.vpc_private_subnets
    }
  }
</code></pre>

kenske
<p>One profile one AZ allows you to deploy pod in specific AZ. See <a href="https://docs.aws.amazon.com/eks/latest/userguide/fargate-profile.html" rel="nofollow noreferrer">here</a>:</p>
<blockquote>
<p>Amazon EKS and Fargate spread pods across each of the subnets that's
defined in the Fargate profile. However, you might end up with an
uneven spread. If you must have an even spread, use two Fargate
profiles. Even spread is important in scenarios where you want to
deploy two replicas and don't want any downtime. We recommend that
each profile has only one subnet.</p>
</blockquote>
