kubernetes-ops
kubernetes-ops copied to clipboard
Add support for Graviton instances
Graviton instances are based on ARM 64 bit architecture and offer great price/performance ratios. I tried adding a new node group (ng2) for Graviton instances:
node_groups = {
ng1 = {
disk_size = 20
desired_capacity = 2
max_capacity = 4
min_capacity = 1
instance_types = ["t3.small"]
capacity_type = "SPOT"
additional_tags = var.tags
k8s_labels = {}
}
ng2 = {
disk_size = 20
desired_capacity = 1
max_capacity = 4
min_capacity = 1
instance_types = ["t4g.small"]
capacity_type = "SPOT"
additional_tags = var.tags
k8s_labels = {}
}
}
Applying the Terraform code results in an error. The error message shows it tries to use x86 Amazon Linux 2 image, which is not valid, since it needs the ARM64 bit image:
│ Error: error creating EKS Node Group (staging:staging-ng2-enhanced-grubworm): InvalidParameterException: [t4g.small] is not a valid instance type for requested amiType AL2_x86_64 │ { │ RespMetadata: { │ StatusCode: 400, │ RequestID: "73318df5-e6c3-4e1e-ad3b-7b209bc182f6" │ }, │ ClusterName: "staging", │ Message_: "[t4g.small] is not a valid instance type for requested amiType AL2_x86_64", │ NodegroupName: "staging-ng2-enhanced-grubworm" │ } │ │ with module.eks.module.eks.module.node_groups.aws_eks_node_group.workers["ng2"], │ on .terraform/modules/eks.eks/modules/node_groups/node_groups.tf line 1, in resource "aws_eks_node_group" "workers": │ 1: resource "aws_eks_node_group" "workers" { │
Thank you!
Adding some other info from @danrg Example Graviton TF impl: https://github.com/niallthomson/eks-graviton-terraform
the critical bits are: ami_type = "AL2_ARM_64" so that it uses the ARM64 image, and instance_types from the separate nodegroup should be Graviton2 ones (such as m6g.medium)
Graviton1 is not supported (a1 instances), and Graviton3 is too new
@seethatgo @danrg is the blocker here not being able to set the base AMI for the EKS nodes?
@sekka1 Indeed, setting another AMI is the blocker here, as Graviton nodes need an ARM AMI.