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) 設定も機能します。

手順

  1. 次のコマンドを実行して、バックアップするワークロードを作成します。

    $ oc create namespace hello-world
    $ oc new-app -n hello-world --image=docker.io/openshift/hello-openshift
  2. 次のコマンドを実行してルートを公開します。

    $ oc expose service/hello-openshift -n hello-world
  3. 次のコマンドを実行して、アプリケーションが動作していることを確認します。

    $ curl `oc get route/hello-openshift -n hello-world -o jsonpath='{.spec.host}'`

    次の例のような出力が表示されます。

    Hello OpenShift!
  4. 次のコマンドを実行して、ワークロードをバックアップします。

    $ 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
  5. バックアップが完了するまで待ってから、次のコマンドを実行します。

    $ 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
    }
  6. 次のコマンドを実行して、デモワークロードを削除します。

    $ oc delete ns hello-world
  7. 次のコマンドを実行して、バックアップからワークロードを復元します。

    $ cat << EOF | oc create -f -
      apiVersion: velero.io/v1
      kind: Restore
      metadata:
        name: hello-world
        namespace: openshift-adp
      spec:
        backupName: hello-world
    EOF
  8. 次のコマンドを実行して、復元が完了するまで待ちます。

    $ 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
    }
  9. 次のコマンドを実行して、ワークロードが復元されていることを確認します。

    $ oc -n hello-world get pods

    次の例のような出力が表示されます。

    NAME                              READY   STATUS    RESTARTS   AGE
    hello-openshift-9f885f7c6-kdjpj   1/1     Running   0          90s
  10. 次のコマンドを実行して JSONPath を確認します。

    $ curl `oc get route/hello-openshift -n hello-world -o jsonpath='{.spec.host}'`

    次の例のような出力が表示されます。

    Hello OpenShift!
    注記

    トラブルシューティングのヒントについては、トラブルシューティングのドキュメント を参照してください。

Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

Red Hat ドキュメントについて

Legal Notice

Theme

© 2026 Red Hat
トップに戻る