how can I scale down pods to 0 and back up on a schedule in Kubernetes
how can I scale down pods to 0 and back up on a schedule in Kubernetes
Thank you for the response. Should it be in conjunction with the API-initiated Eviction? or Cron Scaler is enough? so can I scale down the pods in the resource to 0 at 9 pm and back up at 8 am? When it is up, it will still have the ability to auto-scale when the app is needed, right? I'm asking to learn. Thank you!
@ErDilber-0807 , API-initiated eviction is the process by which you use the Eviction API to create an Eviction object that triggers graceful pod termination. If I am not mistaken your intent is not to evict pods from node but essentially to scale the application. In that case, I believe, the Cron Scaler mentioned earlier should be enough. There can be two (or more) seperate spec.triggers in the ScaledObject resource - one to scale down the application to desiredReplicas: "0" between a defined start and end time (around 9 pm in your case); the other to scale up to the appropriate desiredReplicas value between it's own defined start and end time (around 8 am in your case) [contd]
When it is up, it will still have the ability to auto-scale when the app is needed, right?
KEDA allows you to use multiple triggers as part of the same ScaledObject or ScaledJob.
By doing this, your autoscaling becomes better:
All your autoscaling rules are in one place
You will not have multiple ScaledObject's or ScaledJob's interfering with each other
KEDA will start scaling as soon as when one of the triggers meets the criteria. Horizontal Pod Autoscaler (HPA) will calculate metrics for every scaler and use the highest desired replica count to scale the workload to.
NOTE: You can find all supported triggers here.
@ErDilber-0807 , thank you for your question.
You can use the Cron Scaler available for KEDA to scale applications based on a cron schedule. Trigger Specification and Example are mentioned in the link shared.
Disclaimer: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as convenient to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
Hope this helps.
Please "Accept as Answer" if it helped, so that it can help others in the community looking for help on similar topics.
5 people are following this question.