eksctl icon indicating copy to clipboard operation
eksctl copied to clipboard

[Feature] EKSCTL can create scheduled scaling rules

Open kderck opened this issue 2 years ago • 9 comments

What feature/behavior/change do you want?

I would like to be able to control Auto Scaling Groups created by EKS with eksctl. We use a Scheduled Scaling a part of ASG to scale down the clusters after work hours to reduce cost It would be nice if we could include the scaling rules inside of the yaml.

Why do you want this feature?

It would be able to track these rules as infrastructure as code.

kderck avatar Jul 20 '22 22:07 kderck

Hello kderck :wave: Thank you for opening an issue in eksctl project. The team will review the issue and aim to respond within 1-3 business days. Meanwhile, please read about the Contribution and Code of Conduct guidelines here. You can find out more information about eksctl on our website

github-actions[bot] avatar Jul 20 '22 22:07 github-actions[bot]

Plus 1 on this - having the ability to apply scheduled scaling rules within eksctl can allow us to program scaledown events for dev clusters to save money.

tnh avatar Aug 25 '22 01:08 tnh

Hi all, any updates on this? Applying it manually after cluster creation is not an effective manner. It would save us a lot of money and overhead

lfpalacios avatar Dec 24 '22 03:12 lfpalacios

Hi, why don't you use cluster autoscaler https://github.com/kubernetes/autoscaler? You can still set a maximum in the ASG group. Does aws provides cheaper EC2 instances using a Scheduled Scaling?

bcoromina avatar Jan 25 '23 09:01 bcoromina

Hi @bcoromina the Cluster Autoscaler communicates with the EC2 Auto Scaling Group to scale up, or to scale down. The Cluster Autoscaler does this by making requests to the Auto Scaling Group API. There is no option in the Cluster Autoscaler to scale down to 0 at specific times. The reason we want to scale down to this is so we can safe cost by turning nodes off overnight and turning them on in the morning to safe cost.

kderck avatar Jan 25 '23 10:01 kderck

If you want to force instance to 0 at specific time and ignore the possible activity that makes sense.

bcoromina avatar Jan 25 '23 10:01 bcoromina

Hey @Himangini This seems like a good new addition to eksctl. I'd like to take a stab at it.

hassaanakram avatar Jun 11 '23 09:06 hassaanakram

@hassaanakram Ty for showing interest in contributing to eksctl 🎉 . Please feel free to open a PR, we're happy to review it ✨ Here's the contributing guide to get you started 👍🏻

Himangini avatar Jun 14 '23 11:06 Himangini

Hi @Himangini

I have some questions, but before that some context:

Scheduled Scaling action is a property of the Auto scaling group and therefore the ASG must exist before Scheduled Scaling rules may be applied. Therefore, the Scheduled Scaling resource cannot be added to the NodeGroup CloudFormation template and must come after the NodeGroup ASG creation.

I can see two ways to do that (after node group creation)

  1. Create a new stack for the Scheduled Scaling Config as a sequential task after NG creation (right now, I have implemented this)
  2. Use https://github.com/weaveworks/eksctl/blob/0a5bae44cda1a58bb3410f9949a81090c6d8eb12/pkg/awsapi/autoscaling.go#L476 as a sequential task

I am not really sure which is the idiomatic way to move forward here. Your input will be appreciated. Thanks!

Draft PR for ref: https://github.com/weaveworks/eksctl/pull/6732

hassaanakram avatar Jun 22 '23 10:06 hassaanakram