Jihyun
Jihyun

Reputation: 1105

how to take a backup or rollback to a previous version

I am updating a dc router resource by "oc edit dc router -n default" command. But before making any update, I wanted to take a backup of current resource. I ran "oc export dc router -n default" and the saved the output as a backup. But the command "export" is deprecated. It says the following: Command "export" is deprecated, use the oc get --export oc get --export command does not show the resource but it shows

# oc get --export dc router -n default
NAME      REVISION   DESIRED   CURRENT   TRIGGERED BY
router    0          3         0         config

oc describe command shows more detailed information but It contains unnecessary information too. I just wanted to take a backup in case any trouble and to keep track of the changes made to the resource. Should I use "oc export" command for the purpose? Thank you

Upvotes: 0

Views: 697

Answers (1)

David Ogren
David Ogren

Reputation: 4810

I'm sure there are lots of ways to do this. Your question title talks about backup/restore, so I'll send you to the full backup/restore docs. https://docs.openshift.com/container-platform/4.10/backup_and_restore/application_backup_and_restore/backing_up_and_restoring/backing-up-applications.html

However, that seems overkill for what you are actually asking. If all you are doing to try and get the definition for an object (like a router), just specify the output format of your get to something you can reuse (e.g. YAML or JSON). For example,

oc get -o yaml pod

Then you can just pipe that output into a file. And then use oc create or oc apply to "restore" that definition if you want to later.

Upvotes: 2

Related Questions