Search code examples
amazon-web-servicesterraformversionamazon-eks

Unable to create new EKS with terraform


I'm having problems creating a new EKS version 1.22 in a dev environment. I'm using the module in Terraform registry, trimming some parts since it's only for testing purposes (we just want to test the version 1.22). I'm using a VPC that was created for testing EKS's, and 2 public subnets and 2 private subnets.

This is my main.tf:

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

  cluster_name    = "EKSv2-update-test"
  cluster_version = "1.22"

  cluster_endpoint_private_access = true
  cluster_endpoint_public_access  = true

  cluster_addons = {
    coredns = {
      resolve_conflicts = "OVERWRITE"
    }
    kube-proxy = {}
    vpc-cni = {
      resolve_conflicts = "OVERWRITE"
    }
  }


  vpc_id     = "vpc-xxx" # eks-vpc
  subnet_ids = ["subnet-priv-1-xxx", "subnet-priv-2-xxx", "subnet-pub-1-xxx", "subnet-pub-2-xxx"]
}

Terraform apply times out after 20 min (it just hangs on module.eks.aws_eks_addon.this["coredns"]: Still creating... [20m0s elapsed])

and this is the error

│ Error: unexpected EKS Add-On (EKSv2-update-test:coredns) state returned during creation: timeout while waiting for state to become 'ACTIVE' (last state: 'DEGRADED', timeout: 20m0s)
│ [WARNING] Running terraform apply again will remove the kubernetes add-on and attempt to create it again effectively purging previous add-on configuration
│ 
│   with module.eks.aws_eks_addon.this["coredns"],
│   on .terraform/modules/eks/main.tf line 305, in resource "aws_eks_addon" "this":
│  305: resource "aws_eks_addon" "this" {

The EKS gets created, but this is clearly not the way to go. Regarding coredns, what am I missing?

Thanks


Solution

  • a minimum of 2 cluster nodes are required for addon coredns to meet its requirements for its replica set