Bartosz Bierkowski - Low dose cloud

OpenShift Morsels: rolling deployment strategy

On day #18 lets look at first deployment strategy.

The rolling deployment strategy is the default strategy used in OpenShift and Kubernetes.
You can find it in your deployment config by running oc export dc <dc-name>.

Above you can see the strategy details. Deployment strategy is used when rolling out new version of the application. OpenShift by itself does not know how does your application behave if you bring more instances of it. How many instances can be down when rolling out a new version? Can more instances be started for the time of the rollout?

These are the questions you usually know answer to, but not OpenShift. You can encode the answers into Rolling strategy parameters to let the system know how it should deal with your application.

Two most interesting parameters are maxSurge nad maxUnavailable. They inform how many new pods can be created with the application and how many can be stopped.
Lets say that the application has 12 replicas.
With maxSurge set to 25%, OpenShift can create first 3 new pods to the total count of 15 before stopping one of the old ones. This can be done of course if your application supports it eg. because of licensing or cpu/memory requirements. After creating these 3 pods, gradually old pods will be stopped and new ones will be brought to life.
With maxUnavailable set to 25%, OpenShift will first stop up to 3 pods and then start new version of application. This ensures that there will be always at least 9 pods running with your application before any other pod is stopped. That is a good approach if you have other constrains that prevent you from spinning up new pods.

Documentation

https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#writing-a-deployment-spec – official Kubernetes documentation about Deployments

https://docs.openshift.org/3.6/dev_guide/deployments/deployment_strategies.html – OpenShift deployment strategies guide

Environment

The commands were executed using minishift and the following client/server versions of OpenShift.

Client:
oc v3.7.0+7ed6862
client kubernetes v1.7.6+a08f5eeb62
Server:
openshift v3.6.0+c4dd4cf
server kubernetes v1.6.1+5115d708d7

Newsletter

Thanks for reading the OpenShift morsels. To get updates about new articles, you can sign up to the newsletter below.

As a thank you message, you will also get access to OpenShift CLI CheatSheet listing most commonly used commands together with a short explanation.

Did you like the article?
Join the newsletter to receive notifications about new articles.
I respect your privacy.