【问题标题】:terraform.apply InvalidParameterException: The following supplied instance types do not exist: [m4.large]terraform.apply InvalidParameterException:以下提供的实例类型不存在:[m4.large]
【发布时间】:2021-08-11 16:40:32
【问题描述】:

我的EC2 实例中有以下cluster.tf 文件(类型:t3.micro):

locals {
  cluster_name = "my-eks-cluster"
}

module "vpc" {
  source = "git::https://git@github.com/reactiveops/terraform-vpc.git?ref=v5.0.1"

  aws_region = "eu-north-1"
  az_count   = 3
  aws_azs    = "eu-north-1a, eu-north-1b, eu-north-1c"

  global_tags = {
    "kubernetes.io/cluster/${local.cluster_name}" = "shared"
  }
}

module "eks" {
  source       = "git::https://github.com/terraform-aws-modules/terraform-aws-eks.git?ref=v16.1.0"
  cluster_name = local.cluster_name
  cluster_version = "1.17"
  vpc_id       = module.vpc.aws_vpc_id
  subnets      = module.vpc.aws_subnet_private_prod_ids

  node_groups = {
    eks_nodes = {
      desired_capacity = 3
      max_capacity     = 3
      min_capaicty     = 3

      instance_type = "t3.micro"
    }
  }

  manage_aws_auth = false
}

但是当我运行命令 terraform.apply 时,我得到了这个异常:

Error: error creating EKS Node Group (my-eks-cluster/my-eks-cluster-eks_nodes-divine-pig): InvalidParameterException: The following supplied instance types do not exist: [m4.large]

我尝试用谷歌搜索,但找不到解决方案...

【问题讨论】:

    标签: amazon-ec2 terraform amazon-eks


    【解决方案1】:

    我以前没有使用过 AWS 模块,但在该 GitHub 存储库链接上的 modules/node_groups 中,您可能需要设置 node_group_defaults

    原因是instance type 行的If unset 列表示将使用[var.workers_group_defaults[instance_type]] 中的值。

    该默认值位于根目录 local.tf 中,值为 m4.large,因此您的 AWS 区域可能不支持该实例类型?

    不确定如何完全解决此问题,但可能有助于开始排除故障。

    【讨论】:

    • 确实将local.trf 中的值更改为t3.micro 解决了这个问题! tnx!
    • @rel.foo.fighters 你的 min、max 和 desired_capacity 字段呢?这些看起来他们也会从该 local.tf 文件中为 workers_group_defaults 获取默认值。
    猜你喜欢
    • 1970-01-01
    • 2019-03-27
    • 1970-01-01
    • 1970-01-01
    • 2020-04-08
    • 1970-01-01
    • 1970-01-01
    • 2018-05-07
    • 1970-01-01
    相关资源
    最近更新 更多