3.3. Cluster Application Migration (CAM) ツールのデプロイ
Cluster Application Migration (CAM) ツールをデプロイするには、Cluster Application Migration Operator を OpenShift Container Platform 4.2 ソース と OpenShift Container Platform 4.2 ターゲットクラスターにインストールし、 OpenShift Container Platform 4.2 ソースクラスターでクロスオリジンリソース共有を設定する必要があります。
Cluster Application Migration Operator はデフォルトで CAM ツール(CAM Web コンソールおよび Migration コントローラー)をターゲットクラスターにインストールします。CAM ツールは OpenShift Container Platform 3 およびリモートクラスターにインストールできます。
3.3.1. OpenShift Container Platform 4.2 ソースクラスターへの Cluster Application Migration Operator のインストール
OLM を使用して OpenShift Container Platform 4.2 ソースクラスターに Cluster Application Migration Operator をインストールできます。
手順
-
OpenShift Container Platform Web コンソールで、Operators
OperatorHub をクリックします。 -
Filter by keyword フィールド (この場合は
Migration
) を使用して Cluster Application Migration Operator を見つけます。 - Cluster Application Migration Operator を選択し、Install をクリックします。
-
Create Operator Subscription ページで
openshift-migration
namespace を選択し、承認ストラテジーを指定します。 Subscribe をクリックします。
Installed Operators ページで、Cluster Application Migration Operator は、InstallSucceeded のステータスで openshift-migration プロジェクトに表示されます。
- Provided APIs の下で View 12 more… をクリックします。
-
Create New
MigrationController をクリックします。 spec
スタンザのmigration_controller
およびmigration_ui
パラメーターを更新します。spec: [...] migration_controller: false migration_ui: false [...]
- Create をクリックします。
-
Workloads
Pods をクリックし、Restic および Velero Pod が実行されていることを確認します。
3.3.2. OpenShift Container Platform 4.2 ターゲットクラスターへのクラスターアプリケーション移行 Operator のインストール
OLM を使用して OpenShift Container Platform 4.2 ターゲットクラスターに Cluster Application Migration Operator をインストールできます。
Cluster Application Migration Operator は、デフォルトで CAM ツールをターゲットクラスターにインストールします。
手順
-
OpenShift Container Platform Web コンソールで、Operators
OperatorHub をクリックします。 -
Filter by keyword フィールド (この場合は
Migration
) を使用して Cluster Application Migration Operator を見つけます。 - Cluster Application Migration Operator を選択し、Install をクリックします。
-
Create Operator Subscription ページで
openshift-migration
namespace を選択し、承認ストラテジーを指定します。 Subscribe をクリックします。
Installed Operators ページで、Cluster Application Migration Operator は、InstallSucceeded のステータスで openshift-migration プロジェクトに表示されます。
- Provided APIs の下で View 12 more… をクリックします。
-
Create New
MigrationController をクリックします。 - Create をクリックします。
-
Workloads
Pods をクリックし、Controller Manager、Migration UI、Restic、および Velero Pod が実行中であることを確認します。
3.3.3. OpenShift Container Platform 4.2 ソースクラスターでのクロスオリジンリソース共有の設定
ソースクラスターの API サーバーと CAM ツール間の通信を有効にするために、OpenShift Container Platform 4.2 ソースクラスターでクロスオリジンリソース共有を設定する必要があります。
手順
- CAM ツールがインストールされているクラスターにログインします。
CORS 設定の値を取得します。
$ oc get -n openshift-migration route/migration -o go-template='(?i)//{{ .spec.host }}(:|\z){{ println }}' | sed 's,\.,\\.,g'
- ソースクラスターにログインします。
以下のように Kubernetes API サーバー CR を編集します。
$ oc edit apiserver.config.openshift.io cluster
spec
スタンザのadditionalCORSAllowedOrigins
に CORS 設定値を追加します。spec: additionalCORSAllowedOrigins: - (?i)//migration-openshift-migration\.apps\.cluster\.com(:|\z) 1
- 1
- CORS 設定値を指定します。
- 変更を適用するためにファイルを保存します。
設定を確認します。
$ 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
以下のような出力が表示されます。
< 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