How do you rollback a deployment to the previous revision in OpenShift?

Prepare for the Red Hat Openshift Developer EX288 Exam. Study with comprehensive quizzes and flashcards. Each question includes hints and explanations to enhance your understanding. Ace your exam with confidence!

Multiple Choice

How do you rollback a deployment to the previous revision in OpenShift?

Explanation:
OpenShift keeps a revision history for deployments, and there is a built-in command to revert to a previous revision. Rolling back to the immediately prior revision is done with the rollout undo command for the resource, using the syntax oc rollout undo <resource>/<name>. This tells OpenShift to reapply the configuration from the previous revision and trigger a new rollout to bring the system back to that state, including restoring the old pod template and associated ReplicaSet. This approach is preferred over patching or manually resetting, because patching doesn’t guarantee you’re restoring the exact prior state and would require you to manually recreate the previous spec, risking missed fields. Deleting the deployment would remove the object and its revision history, preventing a clean rollback. If you ever need to revert to a specific older revision rather than just the previous one, you can add --to-revision N to the same command. You can also inspect available revisions with oc rollout history <resource>/<name>.

OpenShift keeps a revision history for deployments, and there is a built-in command to revert to a previous revision. Rolling back to the immediately prior revision is done with the rollout undo command for the resource, using the syntax oc rollout undo /. This tells OpenShift to reapply the configuration from the previous revision and trigger a new rollout to bring the system back to that state, including restoring the old pod template and associated ReplicaSet.

This approach is preferred over patching or manually resetting, because patching doesn’t guarantee you’re restoring the exact prior state and would require you to manually recreate the previous spec, risking missed fields. Deleting the deployment would remove the object and its revision history, preventing a clean rollback. If you ever need to revert to a specific older revision rather than just the previous one, you can add --to-revision N to the same command. You can also inspect available revisions with oc rollout history /.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy