This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.1.5. 部署集群应用程序迁移 (CAM) 工具
部署集群应用程序迁移 (CAM) 工具需要在 OpenShift Container Platform 3 源和 OpenShift Container Platform 4.2 目标集群上安装 CAM Operator。 并在OpenShift Container Platform 3 源集群中配置跨原始资源共享。
Cluster Application Migration Operator 默认在目标集群上安装 CAM 工具(CAM web 控制台和迁移控制器)。您可以 在 OpenShift Container Platform 3 和远程集群中安装 CAM 工具。
您可以手动在 OpenShift Container Platform 3 源集群上安装 Cluster Application Migration Operator,因为 OpenShift Container Platform 3 不支持 Operator Lifecycle Manager。
先决条件
-
必须安装
podman
。 您的 OpenShift Container Platform 3 集群需要被配置为从 registry.redhat.io 拉取镜像。
为了拉取镜像,您需要创建一个
imagestreamsecret
,并把它复制到集群中的每个节点。
流程
使用您的红帽客户门户网站账户登陆到 registry.redhat.io:
sudo podman login registry.redhat.io
$ sudo podman login registry.redhat.io
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意如果系统是为无根 Podman 容器配置的,则此过程不需要
sudo
。下载
operator.yml
文件:sudo podman cp $(sudo podman create registry.redhat.io/rhcam-1-2/openshift-migration-rhel7-operator:v1.2):/operator.yml ./
$ sudo podman cp $(sudo podman create registry.redhat.io/rhcam-1-2/openshift-migration-rhel7-operator:v1.2):/operator.yml ./
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 下载
controller-3.yml
文件:sudo podman cp $(sudo podman create registry.redhat.io/rhcam-1-2/openshift-migration-rhel7-operator:v1.2):/controller-3.yml ./
$ sudo podman cp $(sudo podman create registry.redhat.io/rhcam-1-2/openshift-migration-rhel7-operator:v1.2):/controller-3.yml ./
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 登录您的 OpenShift Container Platform 3 集群。
验证集群可以在 registry.redhat.io 中进行身份验证:
oc run test --image registry.redhat.io/ubi8 --command sleep infinity
$ oc run test --image registry.redhat.io/ubi8 --command sleep infinity
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建 Cluster Application Migration Operator CR 对象:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建 Migration controller CR 对象:
oc create -f controller-3.yml
$ oc create -f controller-3.yml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 确认 Velero 和 Restic Pod 正在运行:
oc get pods -n openshift-migration
$ oc get pods -n openshift-migration
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
您可以使用 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
命名空间,并指定批准策略。 点 Subscribe。
在 Installed Operators 页中,Cluster Application Migration Operator 会出现在 openshift-migration 项目中,其状态为 InstallSucceeded。
- 在 Provided APIs 中点 View 12 more….
-
点 Create New
MigrationController。 - 点击 Create。
-
点 Workloads
Pod 来验证 Controller Manager 、Migration UI 、Restic 和 Velero Pod 是否正在运行。
1.5.3. 在 OpenShift Container Platform 3 源集群中配置跨原始资源共享 复制链接链接已复制到粘贴板!
您必须在 OpenShift Container Platform 3 源集群中配置跨原始资源共享,以启用源集群 API 服务器和 CAM 工具间的通信。
流程
- 登录到已安装 CAM 工具的集群。
获取 CORS 配置的值:
oc get -n openshift-migration route/migration -o go-template='(?i)//{{ .spec.host }}(:|\z){{ println }}' | sed 's,\.,\\.,g'
$ oc get -n openshift-migration route/migration -o go-template='(?i)//{{ .spec.host }}(:|\z){{ println }}' | sed 's,\.,\\.,g'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 登陆到 OpenShift Container Platform 3 源集群。
将 CORS 配置值添加到
/etc/origin/master/master-config.yaml
配置文件的corsAllowedOrigins
字段中:corsAllowedOrigins: - (?i)//migration-openshift-migration\.apps\.cluster\.com(:|\z) - (?i)//openshift\.default\.svc(:|\z) - (?i)//kubernetes\.default(:|\z)
corsAllowedOrigins: - (?i)//migration-openshift-migration\.apps\.cluster\.com(:|\z)
1 - (?i)//openshift\.default\.svc(:|\z) - (?i)//kubernetes\.default(:|\z)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 指定您的 CORS 配置。
重启 API 服务器和控制器管理器以应用更改:
在 OpenShift Container Platform 3.7 和 3.9 中,这些组件作为独立主机进程运行,由
systemd
管理,并通过运行以下命令来重新启动:systemctl restart atomic-openshift-master-api atomic-openshift-master-controllers
$ systemctl restart atomic-openshift-master-api atomic-openshift-master-controllers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 在 OpenShift Container Platform 3.10 和 3.11 中,这些组件在由 kubelet 管理的静态 Pod 中运行,并通过运行以下命令来重新启动:
/usr/local/bin/master-restart api /usr/local/bin/master-restart controllers
$ /usr/local/bin/master-restart api $ /usr/local/bin/master-restart controllers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
验证配置:
curl -v -k -X OPTIONS \ "<cluster_url>/apis/migration.openshift.io/v1alpha1/namespaces/openshift-migration/migclusters" \ -H "Access-Control-Request-Method: GET" \ -H "Access-Control-Request-Headers: authorization" \ -H "Origin: https://<CAM_web_console_url>"
$ 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 Copy to Clipboard Copied! Toggle word wrap Toggle overflow 输出结果类似如下:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow