I want to schedule the deployments according to different timings. Is it possible to configure in the deployment.yml files that the deployment should be scaled to 0 at some hour and scaled up again at some other time (Saving costs)?

Can the openshift job scheduler be used to achieve something like this?

What are the possibilities to achieve such a result?

  • You could use two Cron Jobs that patch your deployment's replica count at specific times, one to set it to a higher value at some hour and another to set it to the lower count at a different time.
    – kalatabe
    Commented Mar 16, 2021 at 10:49
  • shoudl the cron jobs be written on the openshift nodes? or is possible to write it with the deployment yaml?
    – Vini
    Commented Mar 16, 2021 at 11:47
  • You can and probably should declare the cronjobs in the deployment, as they are valid resources for k8s: kubernetes.io/docs/concepts/workloads/controllers/cron-jobs
    – kalatabe
    Commented Mar 18, 2021 at 8:45
  • I was able to create 2 cronjobs which would stop and start the deployments. I will add the cronjob that i used as an answer
    – Vini
    Commented Mar 18, 2021 at 12:19


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.