2.3. Cluster Application Migration (CAM) ツールのデプロイ

Cluster Application Migration (CAM) ツールをデプロイするには、Cluster Application Migration Operator を OpenShift Container Platform 4.1 ソースOpenShift Container Platform 4.2 ターゲットクラスターにインストールし、 OpenShift Container Platform 4.1 ソースクラスターでクロスオリジンリソース共有を設定する必要があります。

Cluster Application Migration Operator はデフォルトで CAM ツール(CAM Web コンソールおよび Migration コントローラー)をターゲットクラスターにインストールします。CAM ツールは OpenShift Container Platform 3 およびリモートクラスターにインストールできます

2.3.1. OpenShift Container Platform 4.1 ソースクラスターへの CAM Operator のインストール

OLM を使用して OpenShift Container Platform 4.1 ソースクラスターに Cluster Application Migration Operator をインストールできます。

手順

  1. OpenShift Container Platform Web コンソールで、CatalogOperatorHub をクリックします。
  2. Filter by keyword フィールド (この場合は Migration) を使用して Cluster Application Migration Operator を見つけます。
  3. Cluster Application Migration Operator を選択し、Install をクリックします。
  4. Create Operator Subscription ページで openshift-migration namespace を選択し、承認ストラテジーを指定します。
  5. Subscribe をクリックします。

    Installed Operators ページで、Cluster Application Migration Operator は、InstallSucceeded のステータスで openshift-migration プロジェクトに表示されます。

  6. Provided APIs の下で View 12 more…​ をクリックします。
  7. Create NewMigrationController をクリックします。
  8. migration_controller および migration_ui パラメーターを更新し、deprecated_cors_configuration パラメーターを spec スタンザに追加します。

    spec:
      [...]
      migration_controller: false
      migration_ui: false
      [...]
      deprecated_cors_configuration: true
  9. Create をクリックします。
  10. WorkloadsPods をクリックし、Restic および Velero Pod が実行されていることを確認します。

2.3.2. OpenShift Container Platform 4.2 ターゲットクラスターへのクラスターアプリケーション移行 Operator のインストール

OLM を使用して OpenShift Container Platform 4.2 ターゲットクラスターに Cluster Application Migration Operator をインストールできます。

Cluster Application Migration Operator は、デフォルトで CAM ツールをターゲットクラスターにインストールします。

手順

  1. OpenShift Container Platform Web コンソールで、OperatorsOperatorHub をクリックします。
  2. Filter by keyword フィールド (この場合は Migration) を使用して Cluster Application Migration Operator を見つけます。
  3. Cluster Application Migration Operator を選択し、Install をクリックします。
  4. Create Operator Subscription ページで openshift-migration namespace を選択し、承認ストラテジーを指定します。
  5. Subscribe をクリックします。

    Installed Operators ページで、Cluster Application Migration Operator は、InstallSucceeded のステータスで openshift-migration プロジェクトに表示されます。

  6. Provided APIs の下で View 12 more…​ をクリックします。
  7. Create NewMigrationController をクリックします。
  8. Create をクリックします。
  9. WorkloadsPods をクリックし、Controller Manager、Migration UI、Restic、および Velero Pod が実行中であることを確認します。

2.3.3. OpenShift Container Platform 4.1 ソースクラスターでのクロスオリジンリソース共有の設定

ソースクラスターの API サーバーと CAM ツール間の通信を有効にするために、OpenShift Container Platform 4.1 ソースクラスターでクロスオリジンリソース共有を設定する必要があります。

手順

  1. CAM ツールがインストールされているクラスターにログインします。
  2. CORS 設定の値を取得します。

    $ oc get -n openshift-migration route/migration -o go-template='(?i)//{{ .spec.host }}(:|\z){{ println }}' | sed 's,\.,\\.,g'
  3. ソースクラスターにログインします。
  4. OAuth サーバー CR を編集します。

    $ oc edit authentication.operator cluster
  5. CORS 設定値を、spec スタンザの unsupportedConfigOverrides の下にある corsAllowedOrigins に追加します。

    spec:
      unsupportedConfigOverrides:
        corsAllowedOrigins:
        - (?i)//migration-openshift-migration\.apps\.cluster\.com(:|\z) 1
    1
    CORS 設定値を指定します。
  6. 変更を適用するためにファイルを保存します。
  7. 以下のように Kubernetes API サーバー CR を編集します。

    $ oc edit kubeapiserver.operator cluster
  8. CORS 設定値を、spec スタンザの unsupportedConfigOverrides の下にある corsAllowedOrigins に追加します。

    spec:
      unsupportedConfigOverrides:
        corsAllowedOrigins:
        - (?i)//migration-openshift-migration\.apps\.cluster\.com(:|\z) 1
    1
    CORS 設定値を指定します。
  9. 変更を適用するためにファイルを保存します。
  10. 設定を確認します。

    $ curl -v -k -X OPTIONS \
    "<cluster_url>/apis/migration.openshift.io/v1alpha1/namespaces/openshift-migration/migclusters" \ 1
    -H "Access-Control-Request-Method: GET" \
    -H "Access-Control-Request-Headers: authorization" \
    -H "Origin: https://<CAM_web_console_url>" 2
    1
    CORS の設定されたクラスターの URL を指定します。
    2
    CAM Web コンソールの URL を指定します。URL は CORS 設定値をベースとしています (例: https://migration-openshift-migration.apps.cluster)。

    以下のような出力が表示されます。

    < HTTP/2 204
    < access-control-allow-credentials: true
    < access-control-allow-headers: Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, X-Requested-With, If-Modified-Since
    < access-control-allow-methods: POST, GET, OPTIONS, PUT, DELETE, PATCH
    < access-control-allow-origin: https://migration-openshift-migration.apps.cluster
    < access-control-expose-headers: Date
    < cache-control: no-store