Is it possible to use Kubernetes autoscale on cron job pods Is it possible to use Kubernetes autoscale on cron job pods kubernetes kubernetes

Is it possible to use Kubernetes autoscale on cron job pods


HPA is used to scale more pods when pod loads are high, but this won't increase the resources on your cluster.

I think you're looking for cluster autoscaler (works on AWS, GKE and Azure) and will increase cluster capacity when pods can't be scheduled.


This is a Community Wiki answer so feel free to edit it and add any additional details you consider important.

As Dom already mentioned "this won't increase the resources on your cluster." Saying more specifically, it won't create an additional node as Horizontal Pod Autoscaler doesn't have such capability and in fact it has nothing to do with cluster scaling. It's name is pretty self-exlpanatory. HPA is able only to scale Pods and it scales them horizontaly, in other words it can automatically increase or decrease number of replicas of your "replication controller, deployment, replica set or stateful set based on observed CPU utilization (or, with custom metrics support, on some other application-provided metrics)" as per the docs.

As to cluster autoscaling, as already said by Dom, such solutions are implemented in so called managed kubernetes solutions such as GKE on GCP, EKS on AWS or AKS on Azure and many more. You typically don't need to do anything to enable them as they are available out of the box.

You may wonder how HPA and CA fit together. It's really well explained in FAQ section of the Cluster Autoscaler project:

How does Horizontal Pod Autoscaler work with Cluster Autoscaler?

Horizontal Pod Autoscaler changes the deployment's or replicaset'snumber of replicas based on the current CPU load. If the loadincreases, HPA will create new replicas, for which there may or maynot be enough space in the cluster. If there are not enough resources,CA will try to bring up some nodes, so that the HPA-created pods havea place to run. If the load decreases, HPA will stop some of thereplicas. As a result, some nodes may become underutilized orcompletely empty, and then CA will terminate such unneeded nodes.