Terraform-aws-eks: unable to change `asg_desired_capacity` value

Created on 16 Sep 2019  路  9Comments  路  Source: terraform-aws-modules/terraform-aws-eks

I have issues

Hello everyone,

I deployed an eks cluster using this module but the issue is that I was not able to change the value of desired capacity(it default value is 1 i think so).

So what I did was that I increased the asg_min_size value from 1 to 2 but the issue it generated was that it increased the desired_capacity value from 1 to 2. Although I changed the value of asg_min_size from 2 to 1 still its value remained the same.

Although I know it is asg_desired_capacity has been added in the ignore loopback state, to make sure its value is ignored.

I just want to know is there a workaround for it. I think the point of ignoring its value must be mentioned in the document so that everyone knows about it easily.

I'm submitting a...

NONE

  • [x] bug report
  • [x] feature request
  • [ ] support request
  • [ ] kudos, thank you, warm fuzzy

What is the current behaviour?

I am unable to change the asg_desired_capacity value.

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

Not sure, i think it is a bug that increasing the value of asg_min_size changes the value of asg_max_capacity, correct me if I am wrong.

What's the expected behaviour?

I should be able to change the asg_desired_capacity value.

Are you able to fix this problem and submit a PR? Link here if you have already.

I can update the document

Environment details

  • Affected module version: v5.0.1
  • OS: ubuntu:18.04
  • Terraform version: v0.12.7

Any other relevant info

Most helpful comment

The cluster-autoscaler controls all scaling up and down of the cluster. It add nodes when there's Pending pods and drains and removes nodes when they are not required. It is changing the desired capacity of the ASG.

It is the normal way of scaling a cluster as it takes care of draining and moving pods in this process. It is aware of complexities like instance sizes, pod disruption budgets and more. It's this awareness that makes it really the only way to safely scale down a cluster automatically. And that's why asg_desired_capacity is ignored in Terraform.

You can manually and safely scale up the cluster yourself. But scaling down is more complicated 馃檪

All 9 comments

hi @max-rocket-internet,

You made a point in this link, kindly clarify what do you mean by it (like what cluster autoscaler does here and what are its trigger event).

thank you.

The cluster-autoscaler controls all scaling up and down of the cluster. It add nodes when there's Pending pods and drains and removes nodes when they are not required. It is changing the desired capacity of the ASG.

It is the normal way of scaling a cluster as it takes care of draining and moving pods in this process. It is aware of complexities like instance sizes, pod disruption budgets and more. It's this awareness that makes it really the only way to safely scale down a cluster automatically. And that's why asg_desired_capacity is ignored in Terraform.

You can manually and safely scale up the cluster yourself. But scaling down is more complicated 馃檪

@max-rocket-internet thank you for clarification. It would be good if these details are added in the documentation if guys from your side are busy do let me know I will create a PR for it.

@max-rocket-internet although 1 issue still exists which is that if a person changes the value of the asg_min_size from 1 to 2. It changes the value of the desired_capacity that I confirmed from the aws console. But the real problem comes later on in which if the value of asg_min_size is changed from 2 to 1 it doesn't change the value of desired_capacity its value remain 2.

I think it is a bug that should be resolved.

let me know I will create a PR for it.

Please do 馃槂 Maybe add something to https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/autoscaling.md

I think it is a bug that should be resolved.

Maybe but it's very edge case. I don't know how we could resolve this while still ignoring changes to desired_capacity in Terraform?

For your reference, I just set these to min 1, max 100 and then never change it as the cluster-autoscaler does everything else. I think most people are doing something like this, i.e. set and forget.

yes, you are right but these things need to be mentioned in the documentation because it will cause problems for people who update the asg_min_size value by mistake and they will don't have a way to change the value of desired_capaity using terraform although they can change the value using aws console but i dont know that change take affect in the terraform.tfstate or not.

My Suggestions:

  • Add a table of variables in the main README.md because in main README.md no documentation exists. is it fine from you side?
  • I will also update the auto_scalaing doc as you suggested
  1. There's already a table of the main module variables in README. Worker group variables are documented in here so feel free to add a note there.
  2. Cool.

@max-rocket-internet i have created a PR for it kindly have a look at it

the issue has been resolved in #517, closing it.

Was this page helpful?
0 / 5 - 0 ratings