Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValidationError: gp3 is invalid #1205

Closed
3 tasks
ichasco-heytrade opened this issue Jan 29, 2021 · 37 comments · Fixed by #1208
Closed
3 tasks

ValidationError: gp3 is invalid #1205

ichasco-heytrade opened this issue Jan 29, 2021 · 37 comments · Fixed by #1208

Comments

@ichasco-heytrade
Copy link

I have issues

GP3 is unsupported in launch configuration

I'm submitting a...

  • [ x] bug report
  • feature request
  • support request - read the FAQ first!
  • kudos, thank you, warm fuzzy

What is the current behavior?

The cluster can't be created with gp3 launch configuration

If this is a bug, how to reproduce? Please include a code sample if relevant.

module "eks" {
  source          = "terraform-aws-modules/eks/aws"
  cluster_name    = var.stage
  cluster_version = "1.18"
  subnets         = module.vpc.private_subnets
  vpc_id          = module.vpc.vpc_id

  cluster_endpoint_private_access = true
  cluster_endpoint_public_access  = true

  worker_additional_security_group_ids  = [aws_security_group.bastion-sg.id]
  worker_ami_name_filter                = "amazon-eks-node-1.18-v20201211"
  manage_worker_iam_resources           = true
  enable_irsa                           = true

  map_roles = [
    {
      rolearn = module.eks_devops_user-role.role-arn
      username = "devops"
      groups = ["system:masters"]
    },
  ]

  cluster_encryption_config = [
    {
      provider_key_arn = aws_kms_key.eks_secrets.arn
      resources        = ["secrets"]
    }
  ]

  worker_groups = [
    {
      name                  = "spot-1"
      spot_price            = "0.50"
      instance_type         = "m4.large"
      asg_desired_capacity  = 1
      asg_max_size          = 3
      asg_min_size          = 0
      pre_userdata          = "hostnamectl set-hostname $( cat /etc/hostname ).${var.region}.compute.internal"
      kubelet_extra_args    = "--node-labels=node.kubernetes.io/lifecycle=spot,stage=${var.stage}"
      enable_monitoring     = false
      public_ip             = false
      suspended_processes   = ["AZRebalance"]
      tags = [
        {
          "key"                 = "Stage"
          "value"               = var.stage
          "propagate_at_launch" = true
        },
        {
          "key"                 = "k8s.io/cluster-autoscaler/node-template/label/kubernetes.io/lifecycle"
          "value"               = "spot"
          "propagate_at_launch" = false
        },
        {
          "key"                 = "k8s.io/cluster-autoscaler/enabled"
          "value"               = "true"
          "propagate_at_launch" = false
        },
        {
          "key"                 = "k8s.io/cluster-autoscaler/${var.stage}"
          "propagate_at_launch" = "false"
          "value"               = "true"
        }
      ]
    }
  ]
  tags = {
    Stage = var.stage
  }
}

Environment details

  • EKS module version: 14.0.0
  • AWS module version: v3.26.0
  • Terraform version: v0.14.5

Any other relevant info

Error:

Error: Error creating launch configuration: ValidationError: gp3 is invalid. Valid volume types are standard, io1, gp2, st1 and sc1.
        status code: 400, request id: 9d6826bb-a513-4647-9169-c1b49e2dbbd7

Change:

 ~ root_block_device {
          ~ volume_type           = "gp2" -> "gp3" # forces replacement
            # (4 unchanged attributes hidden)
        }
@oscr
Copy link
Contributor

oscr commented Jan 29, 2021

@ichasco-heytrade What region are you using? Since it's a new volume type it might be that it's not available yet.

@ichasco-heytrade
Copy link
Author

Hi @oscr

The region is eu-west-1

It suppose that every regions support it
https://aws.amazon.com/es/blogs/aws/new-amazon-ebs-gp3-volume-lets-you-provision-performance-separate-from-capacity-and-offers-20-lower-price/

Available Today
The gp3 volume type is available for all AWS Regions. You can access the AWS Management Console to launch your first gp3 volume.

Thanks!! :)

@oscr
Copy link
Contributor

oscr commented Jan 29, 2021

@ichasco-heytrade I just got the same error message in the same region. Even if you can create that volume type via the console.

@barryib
Copy link
Member

barryib commented Jan 29, 2021

It sounds like we have to update the aws provider version https://github.com/hashicorp/terraform-provider-aws/blob/main/CHANGELOG.md#3250-january-22-2021.

Can you please change the required provider https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/versions.tf#L5 to 3.25.0 ?

@oscr
Copy link
Contributor

oscr commented Jan 29, 2021

@barryib I'm testing it right now.

@ichasco-heytrade
Copy link
Author

ichasco-heytrade commented Jan 29, 2021 via email

@GerardoGR
Copy link

For the time being, setting the workers_group_defaults.root_volume_type to gp2 seems to work:

  workers_group_defaults = {
  	root_volume_type = "gp2"
  }

@oscr
Copy link
Contributor

oscr commented Jan 29, 2021

This might be an issue with aws launch configuration validation:

https://docs.aws.amazon.com/cli/latest/reference/autoscaling/create-launch-configuration.html

VolumeType -> (string)

The volume type, which can be standard for Magnetic, io1 for Provisioned IOPS SSD, gp2 for General Purpose SSD, st1 for Throughput Optimized HDD, or sc1 for Cold HDD. For more information, see Amazon EBS Volume Types in the Amazon EC2 User Guide for Linux Instances .

Valid Values: standard | io1 | gp2 | st1 | sc1

@marcuz
Copy link

marcuz commented Jan 29, 2021

I have tested with 3.26.0 provider version.

  • Installing hashicorp/aws v3.26.0...
  • Installed hashicorp/aws v3.26.0 (signed by HashiCorp)

@ichasco-heytrade what are your results ?

I have tested with AWS provider 3.26.0 too and getting the same error:

Error: Error creating launch configuration: ValidationError: gp3 is invalid. Valid volume types are standard, io1, gp2, st1 and sc1.
	status code: 400, request id: bc4139d6-d9ce-41fc-8998-1d902bdd3e9d

@barryib
Copy link
Member

barryib commented Jan 29, 2021

It sounds like the aws api doesn't support gp3 for launch configuration https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_Ebs.html.

Does anyone know if this will change in a near future ?

So for now, launch configuration users must set they root_device_type to gp2 as @GerardoGR suggested. We can update the FAQ with this.

@mzupan
Copy link

mzupan commented Jan 29, 2021

gp3 isn't in launch configs yet. If you switch to launch templates gp3 should work. The default for launch configs for this module should be reverted back to gp2 though

edit: I believe AWS is trying to push people to templates over configs. I'd honestly just use templates as I wouldn't expect them to be too quick to add support to configs

@barryib
Copy link
Member

barryib commented Jan 29, 2021

gp3 isn't in launch configs yet. If you switch to launch templates gp3 should work. The default for launch configs for this module should be reverted back to gp2 though

@mzupan there is no default config for LC only. So if we rollback, we will rollback for both LC and LT. FWIW, we plan to drop launch configuration soon to let peoples move to launch template.

@margamanterola
Copy link

This change breaks launching clusters with the default config shown in the basic example. If launch config is no longer supported, then it should be removed from all docs. Having a default value that breaks the default use of the module seems like a recipe for frustrated users.

@barryib
Copy link
Member

barryib commented Jan 29, 2021

Just opened #1208.

@sharjeelsayed
Copy link

For the time being, setting the workers_group_defaults.root_volume_type to gp2 seems to work:

  workers_group_defaults = {
  	root_volume_type = "gp2"
  }

Where do you place this code?

@ichasco-heytrade
Copy link
Author

Hi @sharjeelsayed, you have to place it in the module:

module "eks" {
  source          = "terraform-aws-modules/eks/aws"
...

  workers_group_defaults = {
  	root_volume_type = "gp2"
  }
...
}

@sharjeelsayed
Copy link

Hi @sharjeelsayed, you have to place it in the module:

module "eks" {
  source          = "terraform-aws-modules/eks/aws"
...

  workers_group_defaults = {
  	root_volume_type = "gp2"
  }
...
}

What if I am using the eks_example_basic module?

module "eks_example_basic" {
  source  = "terraform-aws-modules/eks/aws//examples/basic"
  version = "14.0.0"
}

acosta11 added a commit to cloudfoundry/cf-for-k8s that referenced this issue Feb 1, 2021
@shahafy-ma
Copy link

shahafy-ma commented Feb 10, 2021

Hey guys

I am still getting this one

      ~ root_block_device {
            delete_on_termination = true
          ~ encrypted             = false -> (known after apply)
            iops                  = 0
            volume_size           = 100
          ~ volume_type           = "gp2" -> "gp3" # forces replacement
        }
    }
...

Error: Error creating launch configuration: ValidationError: gp3 is invalid. Valid volume types are standard, io1, gp2, st1 and sc1.
        status code: 400, request id: 2cf54f3d-de26-47be-a989-e92af332ed17

Is there any solution? I am using
provider registry.terraform.io/hashicorp/aws v3.27.0

@Saeger
Copy link

Saeger commented Feb 10, 2021

Hey guys

I am still getting this one

      ~ root_block_device {
            delete_on_termination = true
          ~ encrypted             = false -> (known after apply)
            iops                  = 0
            volume_size           = 100
          ~ volume_type           = "gp2" -> "gp3" # forces replacement
        }
    }
...

Error: Error creating launch configuration: ValidationError: gp3 is invalid. Valid volume types are standard, io1, gp2, st1 and sc1.
        status code: 400, request id: 2cf54f3d-de26-47be-a989-e92af332ed17

Is there any solution? I am using
provider registry.terraform.io/hashicorp/aws v3.27.0

I would recommend you for Switching from aws_launch_configuration to aws_launch_template as it already have support for gp3 instances.

@albertoal
Copy link

albertoal commented Feb 10, 2021

Also still getting this on aws provider 3.27.0 and us-east-1. The workaround suggested is working but it will be good to fix the example config so users don't get this error when using it for the first time. Thanks!

@kaushikarvind
Copy link

Hey guys
I am still getting this one

      ~ root_block_device {
            delete_on_termination = true
          ~ encrypted             = false -> (known after apply)
            iops                  = 0
            volume_size           = 100
          ~ volume_type           = "gp2" -> "gp3" # forces replacement
        }
    }
...

Error: Error creating launch configuration: ValidationError: gp3 is invalid. Valid volume types are standard, io1, gp2, st1 and sc1.
        status code: 400, request id: 2cf54f3d-de26-47be-a989-e92af332ed17

Is there any solution? I am using
provider registry.terraform.io/hashicorp/aws v3.27.0

I would recommend you for Switching from aws_launch_configuration to aws_launch_template as it already have support for gp3 instances.

How to switch to 'aws_launch_template'

@innovate-invent
Copy link

How to switch to 'aws_launch_template'

Someone correct me if I am wrong but in your module config you just change worker_groups = [...] to worker_groups_launch_template = [...]

@LukaszRacon
Copy link

If you switch from worker_groups to worker_groups_launch_template - you might also want to preserve ASG (adjust for location of your module):
terraform state mv module.eks.aws_autoscaling_group.workers[0] module.eks.aws_autoscaling_group.workers_launch_template[0]

@luis02lopez
Copy link

For "aws" (2.70.0), using launch templates, still, receive this error:

Error: aws_launch_template.module: expected block_device_mappings.0.ebs.0.volume_type to be one of [standard gp2 io1 sc1 st1], got gp3

@innovate-invent
Copy link

innovate-invent commented Feb 17, 2021

I tried this in us-east-1 and it succeeded after making the change I suggested.

Edit: It appears with my suggested change the autoscaler no longer works.
invalid metrics (1 invalid out of 1), first error is: failed to get cpu utilization: unable to get metrics for resource cpu: no metrics returned from resource metrics API
After the first node fills the remaining pods fail to schedule.

Edit2: This may be related to the pods failing to match a PVC on the new node

Edit3: I think the launch template needs to specify the PVC somehow

Edit4: Everything works now. I somehow managed to unlink a role binding for the CSI driver...

@vbagmar
Copy link

vbagmar commented Mar 7, 2021

What's the fix? I had to change to gp2 for us-west-1

@innovate-invent
Copy link

@vbagmar #1205 (comment)

@vsenapathy
Copy link

Do we know when gp3 will be available for Launch configuration?

@innovate-invent
Copy link

@vsenapathy is there a reason to not switch to launch templates? From what I understand, launch configurations are depreciated.

@vsenapathy
Copy link

Oh i can move to Launch templates and test this.

@vsenapathy
Copy link

vsenapathy commented Mar 8, 2021

@innovate-invent: I was able to get this to work with Launch template.

@sollie
Copy link

sollie commented Mar 10, 2021

@innovate-invent

From what I understand, launch configurations are depreciated.

Do you have a source for that? Couldn't find anything with a quick google search.

@innovate-invent
Copy link

@sollie #1205 (comment)

@sollie
Copy link

sollie commented Mar 11, 2021

@innovate-invent ah, thanks. Missed that while skimming.

@razor-x
Copy link

razor-x commented Mar 26, 2021

@vsenapathy is there a reason to not switch to launch templates? From what I understand, launch configurations are depreciated.

At least for me this is the main blocker for moving to launch templates: terraform-aws-modules/terraform-aws-autoscaling#54

@fabianomartinsrj
Copy link

fabianomartinsrj commented Apr 13, 2021

I've made an override to default values on my template, with no need to change the values from module.

    {
     ...
      root_volume_type   = "gp2"
      ...
    }
  ]

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.