5.5.5. OpenShift Container Platform を使用した OADP 上のワークロードのバックアップ
ROSA 上のワークロードのバックアップと復元には、OADP を使用できます。ワークロードのバックアップを作成し、バックアップから復元し、復元を検証することができます。OADPOperator、バックアップストレージ、および AWS リソースが不要になった場合は、それらをクリーンアップすることもできます。
5.5.5.1. 例:OADP と OpenShift Container Platform を使用したバックアップの実行 リンクのコピーリンクがクリップボードにコピーされました!
OpenShift Container Platform で OpenShift API for Data Protection (OADP) を使用してバックアップを実行します。次の hello-world アプリケーションの例では、永続ボリューム (PV) がアタッチされていません。
どちらの Data Protection Application (DPA) 設定も機能します。
手順
次のコマンドを実行して、バックアップするワークロードを作成します。
$ oc create namespace hello-world$ oc new-app -n hello-world --image=docker.io/openshift/hello-openshift次のコマンドを実行してルートを公開します。
$ oc expose service/hello-openshift -n hello-world次のコマンドを実行して、アプリケーションが動作していることを確認します。
$ curl `oc get route/hello-openshift -n hello-world -o jsonpath='{.spec.host}'`次の例のような出力が表示されます。
Hello OpenShift!次のコマンドを実行して、ワークロードをバックアップします。
$ cat << EOF | oc create -f - apiVersion: velero.io/v1 kind: Backup metadata: name: hello-world namespace: openshift-adp spec: includedNamespaces: - hello-world storageLocation: ${CLUSTER_NAME}-dpa-1 ttl: 720h0m0s EOFバックアップが完了するまで待ってから、次のコマンドを実行します。
$ watch "oc -n openshift-adp get backup hello-world -o json | jq .status"次の例のような出力が表示されます。
{ "completionTimestamp": "2022-09-07T22:20:44Z", "expiration": "2022-10-07T22:20:22Z", "formatVersion": "1.1.0", "phase": "Completed", "progress": { "itemsBackedUp": 58, "totalItems": 58 }, "startTimestamp": "2022-09-07T22:20:22Z", "version": 1 }次のコマンドを実行して、デモワークロードを削除します。
$ oc delete ns hello-world次のコマンドを実行して、バックアップからワークロードを復元します。
$ cat << EOF | oc create -f - apiVersion: velero.io/v1 kind: Restore metadata: name: hello-world namespace: openshift-adp spec: backupName: hello-world EOF次のコマンドを実行して、復元が完了するまで待ちます。
$ watch "oc -n openshift-adp get restore hello-world -o json | jq .status"次の例のような出力が表示されます。
{ "completionTimestamp": "2022-09-07T22:25:47Z", "phase": "Completed", "progress": { "itemsRestored": 38, "totalItems": 38 }, "startTimestamp": "2022-09-07T22:25:28Z", "warnings": 9 }次のコマンドを実行して、ワークロードが復元されていることを確認します。
$ oc -n hello-world get pods次の例のような出力が表示されます。
NAME READY STATUS RESTARTS AGE hello-openshift-9f885f7c6-kdjpj 1/1 Running 0 90s次のコマンドを実行して JSONPath を確認します。
$ curl `oc get route/hello-openshift -n hello-world -o jsonpath='{.spec.host}'`次の例のような出力が表示されます。
Hello OpenShift!注記トラブルシューティングのヒントについては、トラブルシューティングのドキュメント を参照してください。