Summary
Add a dedicated Karpenter module to the EKS.
Problem
The current node autoscaling approach has several limitations:
- Slow scaling response times: Current autoscaling relies on managed node groups(MNG) that have slower response time compared to Karpenter
- Limited instance flexibility: MNGs are tied to their launch templates, and one-size-fits-all is rarely a suitable approach
- Operational overhead: Managing multiple MNGs for different workload profiles adds complexity and maintenance burden
- Cost inefficiency: Karpenter is much more cost-efficient with spot instances and semi-intelligent node selection from the Node Pools
Proposed Solution
Integrate the AWS Karpenter module to the EKS.
module "karpenter" {
source = "terraform-aws-modules/eks/aws//modules/karpenter"
cluster_name = module.eks.cluster_name
# Attach additional IAM policies to the Karpenter node IAM role
node_iam_role_additional_policies = {
AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
}
tags = {
Environment = "dev"
Terraform = "true"
}
}
Reusing the existing Nodes IAM Role:
module "karpenter" {
source = "terraform-aws-modules/eks/aws//modules/karpenter"
cluster_name = module.eks.cluster_name
create_node_iam_role = false
node_iam_role_arn = module.eks.eks_managed_node_groups["initial"].iam_role_arn
# Since the node group role will already have an access entry
create_access_entry = false
tags = {
Environment = "dev"
Terraform = "true"
}
}
Summary
Add a dedicated Karpenter module to the EKS.
Problem
The current node autoscaling approach has several limitations:
Proposed Solution
Integrate the AWS Karpenter module to the EKS.
Reusing the existing Nodes IAM Role: