7.3. バックアップの実行
注記
次のサンプル hello-world アプリケーションには、永続ボリュームが接続されていません。どちらの 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$ curl `oc get route/hello-openshift -n hello-world -o jsonpath='{.spec.host}'`出力例
Hello OpenShift!- トラブルシューティングのヒントは、OADP チームの トラブルシューティングドキュメント を参照してください。
- 追加のサンプルアプリケーションは、OADP チームの サンプルアプリケーションディレクトリー にあります。