Bartosz Bierkowski - Low dose cloud

OpenShift Morsels: rolling out new version of application

Since we talked already about rollout strategies, lets have a look how to rollout this new version of application on day #20

At the beginning the main command responsible for managing deployments was oc deploy . It has deprecated and oc rollout  took over managing of deployment statuses. Whenever a new deployment is started, the Deployment Config configuration is cloned into a new Replication Controller. This way OpenShift stores information about past versions of your application. You may have had different environment variables, different image versions or volumes used across versions. That information is held in the Replication Controllers.

The oc rollout  command, together with subcommands visible below, allows easier (compared to oc deploy ) management of the deployments and versions.

The oc rollout latest and oc rollout cancel are the basic replacements for oc deploy  functionality. Deploying latest deployment config and then cancelling it can be seen below.

I had to specify explicitly that I want to cancel deployment of Deployment Config. No clue why, since anyway only Deployment Config is accepted and trying with Replication Controller does not work.

Displaying history refers to the previous deployments and Replication Controllers. After deleting the Replication Controller number 1, it is no longer visible in history. You can see the output of all 3 commands below.

As for the other subcommands, status  displays information about latest deploy state. The retry  subcommand allows starting again a failed deployment.

Next of the subcommands – undo – gives you possibility to go back to previous working version of the application. Undoing the deployment created a new Replication Controller.

You can also specify which of previous versions you would like to deploy.

Again a new Replication Controller is added, but based on manually selected version of Replication Controller.

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.