OpenShift - Rollback not pointing to previous image

4/5/2020

I am trying to do rollback for a deployment config. I am not finding the rollback pointing to older image. It always points to the latest image.

I am trying out the following commands.

oc rollout undo dc/<name>
oc rollback dc/<name>
oc rollback dc/<name> --to-version=1

Please help.

Thanks.

-- user3930151
kubernetes
openshift
openshift-3
rollback

1 Answer

4/5/2020

First of all, what about check what revision is referred and what revision is remained on your project ?

  1. check how many revision can be saved in your deploymentconfig. DeploymentConfig keeps 10 revision history by default, you can verify the current revision limits using following command.
$ oc get dc/<your dc name> -o yaml  | grep revisionHistoryLimit
  revisionHistoryLimit: 10
  1. check your deploymentconfig deployment history for checking what revision can be referred An you can also list what revision is remained, the "REVISION" number is used for "--to-version"
$ oc rollout history dc/<your dc name>
deploymentconfigs "<your dc name>"
REVISION    STATUS      CAUSE
1       Failed      newer deployment was found running
2       Complete    config change
3       Complete    config change
4       Complete    config change
  1. check current referred revision of your deploymentconfig which shows as "(latest)".
$ oc describe dc/<your dc name>
Deployment #4 (latest):
:
Deployment #3:
:

I think you can find some message why you can not rollback to old revision through above checking, such as some failed deployment messages or information about that.

I hope it help you.

-- Daein Park
Source: StackOverflow