Search code examples
openshiftopenshift-3

Openshift 3: App will not deploy unless pod manually scaled to 0 then back to 1


The only way I can get a new build deployed on my Openshift 3 Starter app is if I manually scale the existing running pod down to 0, deploy my latest build, then scale the pod back to 1.

If I don't manually scale down the pod to 0 the deployment process results in a insufficient memory error or time out. When the system deploys automatically after a new build the log says it scales the pod down to 0, deploys, then scales up to 1 and that is when the error occurs.

My app is on US west 2.

Is this just an Openshift 3 bug or am I building and deploying incorrectly?


Solution

  • This likely means you are at the limit of your memory resources. It occurs because the default deployment strategy is a rolling deployment, which means there needs to be enough memory available to start a new instance, before the old instance is stopped.

    What you need to do is switch the deployment config to use a 'Recreate' deployment strategy instead of 'Rolling'. With this strategy the existing instance will be shut down before a new one is started and so you can work within the memory quota.

    You can change to 'Recreate' by editing the deployment config in the web console, or running the command:

    oc patch dc/yourappname --patch '{"spec":{"strategy":{"type":"Recreate"}}}'