9.11.2. エクスポートされた仮想マシンマニフェストへのアクセス


仮想マシン (VM) またはスナップショットをエクスポートすると、エクスポートサーバーから VirtualMachine マニフェストと関連情報を取得できます。

前提条件

  • OpenShift CLI (oc) がインストールされている。
  • VirtualMachineExport カスタムリソース (CR) を作成して、仮想マシンまたは VM スナップショットをエクスポートしている。

    注記

    spec.source.kind: PersistentVolumeClaim パラメーターを持つ VirtualMachineExport オブジェクトは、仮想マシンマニフェストを生成しません。

手順

  1. マニフェストにアクセスするには、まず証明書をソースクラスターからターゲットクラスターにコピーする必要があります。

    1. ソースクラスターにログインします。
    2. 次のコマンドを実行して、証明書を cacert.crt ファイルに保存します。

      $ oc get vmexport <export_name> -o jsonpath={.status.links.external.cert} > cacert.crt

      <export_name> を、VirtualMachineExport オブジェクトの metadata.name 値に置き換えます。

    3. cacert.crt ファイルをターゲットクラスターにコピーします。
  2. 次のコマンドを実行して、ソースクラスター内のトークンをデコードし、token_decode ファイルに保存します。

    $ oc get secret export-token-<export_name> -o jsonpath={.data.token} | base64 --decode > token_decode

    <export_name> を、VirtualMachineExport オブジェクトの metadata.name 値に置き換えます。

  3. token_decode ファイルをターゲットクラスターにコピーします。
  4. 次のコマンドを実行して、VirtualMachineExport カスタムリソースを取得します。

    $ oc get vmexport <export_name> -o yaml
  5. status.links スタンザを確認します。このスタンザは external セクションと internal セクションに分かれています。各セクション内の manifests.url フィールドに注意してください。以下に例を示します。

    apiVersion: export.kubevirt.io/v1beta1
    kind: VirtualMachineExport
    metadata:
      name: example-export
    spec:
      source:
        apiGroup: "kubevirt.io"
        kind: VirtualMachine
        name: example-vm
      tokenSecretRef: example-token
    status:
    #...
      links:
        external:
    #...
          manifests:
          - type: all
            url: https://vmexport-proxy.test.net/api/export.kubevirt.io/v1beta1/namespaces/example/virtualmachineexports/example-export/external/manifests/all
          - type: auth-header-secret
            url: https://vmexport-proxy.test.net/api/export.kubevirt.io/v1beta1/namespaces/example/virtualmachineexports/example-export/external/manifests/secret
        internal:
    #...
          manifests:
          - type: all
            url: https://virt-export-export-pvc.default.svc/internal/manifests/all
          - type: auth-header-secret
            url: https://virt-export-export-pvc.default.svc/internal/manifests/secret
      phase: Ready
      serviceName: virt-export-example-export
    • status.links.external.manifests.url の タイプall の 場合、VirtualMachine マニフェスト、存在する場合は DataVolume マニフェスト、および外部 URL の Ingress またはルートの公開証明書を含む ConfigMap マニフェストが含まれます。
    • status.links.external.manifests.url のタイプauth-header-secret の場合、Containerized Data Importer (CDI) と互換性のあるヘッダーを含むシークレットが含まれます。ヘッダーには、エクスポートトークンのテキストバージョンが含まれています。
  6. ターゲットクラスターにログインします。
  7. 次のコマンドを実行して Secret マニフェストを取得します。

    $ curl --cacert cacert.crt <secret_manifest_url> -H \
    "x-kubevirt-export-token:token_decode" -H \
    "Accept:application/yaml"
    • <secret_manifest_url> を、VirtualMachineExport YAML 出力の auth-header-secret URL に置き換えます。
    • 前に作成した token_decode ファイルを参照します。

      以下に例を示します。

      $ curl --cacert cacert.crt https://vmexport-proxy.test.net/api/export.kubevirt.io/v1beta1/namespaces/example/virtualmachineexports/example-export/external/manifests/secret -H "x-kubevirt-export-token:token_decode" -H "Accept:application/yaml"
  8. 次のコマンドを実行して、ConfigMap マニフェストや VirtualMachine マニフェストなどの type: all マニフェストを取得します。

    $ curl --cacert cacert.crt <all_manifest_url> -H \
    "x-kubevirt-export-token:token_decode" -H \
    "Accept:application/yaml"
    • <all_manifest_url> を、VirtualMachineExport YAML 出力の URL に置き換えます。
    • 前に作成した token_decode ファイルを参照します。

      以下に例を示します。

      $ curl --cacert cacert.crt https://vmexport-proxy.test.net/api/export.kubevirt.io/v1beta1/namespaces/example/virtualmachineexports/example-export/external/manifests/all -H "x-kubevirt-export-token:token_decode" -H "Accept:application/yaml"

次のステップ

  • エクスポートしたマニフェストを使用して、ターゲットクラスター上に ConfigMap オブジェクトと VirtualMachine オブジェクトを作成できます。
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

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

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

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

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

会社概要

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

Theme

© 2026 Red Hat
トップに戻る