Difference between revisions of "Terraform EKS Karpenter submodule"

From wikieduonline
Jump to navigation Jump to search
Line 2: Line 2:
  
 
== Karpenter official example using Node Groups ==
 
== Karpenter official example using Node Groups ==
<pre>
 
module "eks" {
 
  source = "terraform-aws-modules/eks"
 
  
  # Shown just for connection between cluster and Karpenter sub-module below
+
module "eks" {
  eks_managed_node_groups = {
+
  source = "terraform-aws-modules/eks"
    initial = {
+
      instance_types = ["t3.medium"]
+
  # Shown just for connection between cluster and Karpenter sub-module below
 +
  [[eks_managed_node_groups]] = {
 +
    initial = {
 +
      instance_types = ["t3.medium"]  
 +
 +
      min_size    = 1
 +
      max_size    = 3
 +
      desired_size = 1
 +
    }
 +
  }
 +
  ...
 +
}
  
      min_size    = 1
+
module "karpenter" {
      max_size    = 3
+
  source = "terraform-aws-modules/eks/aws//modules/karpenter"  
      desired_size = 1
+
    }
+
  cluster_name = module.eks.cluster_name
  }
+
  ...
+
  irsa_oidc_provider_arn          = module.eks.oidc_provider_arn
}
+
  irsa_namespace_service_accounts = ["karpenter:karpenter"]
 
+
 
module "karpenter" {
+
  create_iam_role = false
  source = "terraform-aws-modules/eks/aws//modules/karpenter"
+
  iam_role_arn    = module.eks.eks_managed_node_groups["initial"].iam_role_arn  
 
+
  cluster_name = module.eks.cluster_name
+
  tags = {  
 
+
    Environment = "dev"
  irsa_oidc_provider_arn          = module.eks.oidc_provider_arn
+
    Terraform  = "true"
  irsa_namespace_service_accounts = ["karpenter:karpenter"]
+
  }
 
+
}
  create_iam_role = false
 
  iam_role_arn    = module.eks.eks_managed_node_groups["initial"].iam_role_arn
 
 
 
  tags = {
 
    Environment = "dev"
 
    Terraform  = "true"
 
  }
 
}
 
</pre>
 
  
 
== Related ==
 
== Related ==

Revision as of 11:02, 20 December 2023

Karpenter official example using Node Groups

module "eks" {
  source = "terraform-aws-modules/eks" 

  # Shown just for connection between cluster and Karpenter sub-module below
  eks_managed_node_groups = {
    initial = {
      instance_types = ["t3.medium"] 

      min_size     = 1
      max_size     = 3
      desired_size = 1
    }
  }
  ...
}
module "karpenter" {
  source = "terraform-aws-modules/eks/aws//modules/karpenter" 

  cluster_name = module.eks.cluster_name

  irsa_oidc_provider_arn          = module.eks.oidc_provider_arn
  irsa_namespace_service_accounts = ["karpenter:karpenter"]
 
  create_iam_role = false
  iam_role_arn    = module.eks.eks_managed_node_groups["initial"].iam_role_arn 

  tags = { 
    Environment = "dev"
    Terraform   = "true"
  }
}

Related

See also

Advertising: