Time-based scaling with Kubernetes CronJob: How to avoid deployments overriding minReplicas Time-based scaling with Kubernetes CronJob: How to avoid deployments overriding minReplicas kubernetes kubernetes

Time-based scaling with Kubernetes CronJob: How to avoid deployments overriding minReplicas


I think you could also consider the following two options:


Use helm to manage the life-cycle of your application with lookup function:

The main idea behind this solution is to query the state of specific cluster resource (here HPA) before trying to create/recreate it with helm install/upgrade commands.

I mean to check the current minReplicas value each time before you upgrade your application stack.


Manage the HPA resource separately to application manifest files

Here you can handover this task to a dedicated HPA operator, which can coexist with your CronJobs that adjust minReplicas according specific schedule: