Home > Software design >  What's the difference between creating one fargate profile for each availability zone, and crea
What's the difference between creating one fargate profile for each availability zone, and crea

Time:01-28

I'm in the process of creating fargate profiles for my AWS EKS cluster using terraform. In this example for the Terraform Karpenter module, they have a loop that creates one profile for each of the 3 availability zones used in the example:


  fargate_profiles = { 
    for i in range(3) :
      "karpenter-${element(split("-", local.azs[i]), 2)}" => {
        selectors = [
          { namespace = "karpenter" }
        ]
        # We want to create a profile per AZ for high availability
        subnet_ids = [element(module.vpc.private_subnets, i)]
      }
  }
  

Why is this necessary? What's the difference between this and creating a single profile that is attached to 3 zones? Something like this:

  fargate_profiles = {
    "karpenter" = {
      selectors = [
        { namespace = "karpenter" }
      ]
      subnet_ids = var.vpc_private_subnets
    }
  }

CodePudding user response:

One profile one AZ allows you to deploy pod in specific AZ. See here:

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.

  • Related