CodexBloom - Programming Q&A Platform

Terraform 1.4.1: Issues with AWS EKS Cluster Autoscaler Not Scaling Nodes

πŸ‘€ Views: 41 πŸ’¬ Answers: 1 πŸ“… Created: 2025-08-06
terraform aws eks cluster-autoscaler kubernetes hcl

I'm currently facing a challenge with my Terraform configuration for an AWS EKS cluster where the Cluster Autoscaler isn't scaling the nodes as expected. I have configured the autoscaler with the correct IAM roles and permissions, but it seems to ignore the scaling policies I set. Here’s a snippet of my Terraform configuration: ```hcl resource "aws_eks_cluster" "my_cluster" { name = "my-cluster" role_arn = aws_iam_role.eks_role.arn vpc_config { subnet_ids = aws_subnet.my_subnets.*.id } } resource "aws_eks_node_group" "my_nodes" { cluster_name = aws_eks_cluster.my_cluster.name node_group_name = "my-node-group" node_role_arn = aws_iam_role.node_role.arn subnet_ids = aws_subnet.my_subnets.*.id scaling_config { desired_size = 2 max_size = 5 min_size = 1 } } ``` I've also installed the Cluster Autoscaler on the EKS cluster using the following Helm command: ```bash helm repo add autoscaler https://kubernetes.github.io/autoscaler helm install cluster-autoscaler autoscaler/cluster-autoscaler \ --set autoDiscovery.clusterName=my-cluster \ --set awsRegion=us-west-2 \ --set rbac.create=true \ --set image.tag=v1.21.0 \ --set extraArgs.v=4 ``` Despite following the installation instructions, the autoscaler logs show repeated messages indicating "No nodes found" and "Ignoring unrecognized pod". I've verified that the IAM policies associated with the Cluster Autoscaler role allow it to interact with EC2 and EKS. Here’s the relevant IAM policy: ```json { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ec2:DescribeInstances", "ec2:DescribeInstanceTypes", "ec2:RunInstances", "ec2:TerminateInstances", "eks:DescribeCluster", "eks:ListClusters" ], "Resource": "*" } ] } ``` I've tried reapplying the Terraform configuration and restarting the Cluster Autoscaler pod, but nothing seems to resolve the issue. Any insights on what might be misconfigured or overlooked would be greatly appreciated!