Body: <p>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)?</p>
  <p>Can the openshift job scheduler be used to achieve something like this?</p>
  <p>What are the possibilities to achieve such a result?</p>
  
Comments: CC BY-SA 4.0
Comments: 2021-03-16T10:49:14.440Z
Comments: 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.
Comments: kalatabe
Comments: CC BY-SA 4.0
Comments: 2021-03-16T11:47:24.787Z
Comments: shoudl the cron jobs be written on the openshift nodes? or is possible to write it with the deployment yaml?
Comments: Vini
Comments: CC BY-SA 4.0
Comments: 2021-03-18T08:45:02.280Z
Comments: You can and probably should declare the cronjobs in the deployment, as they are valid resources for k8s: https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/
Comments: kalatabe
Comments: CC BY-SA 4.0
Comments: 2021-03-18T12:19:17.153Z
Comments: 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
Comments: Vini
Tags: <openshift>
Title: Auto start and stop of deployments and pods
UserDisplayName: Vini
ThreadText: # Auto start and stop of deployments and pods
  
  (Asked by: username_0 on 2021-03-16)
  
  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?
  
  **Tags:** openshift
  
  > **Comments:**
  > **username_1**: 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.  
  > **username_0**: shoudl the cron jobs be written on the openshift nodes? or is possible to write it with the deployment yaml?  
  > **username_1**: You can and probably should declare the cronjobs in the deployment, as they are valid resources for k8s: https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/  
  > **username_0**: 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  
  
  ---
  
  ## 0 answers
  
  