On day #18 lets look at first deployment strategy.
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
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.
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
The commands were executed using minishift and the following client/server versions of OpenShift.
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.