1.7. 使用 Control Plane Migration Assistant (CPMA) 迁移 control plane 设置

Control Plane Migration Assistant (CPMA) 是一个基于 CLI 的工具,它可帮助您将 control plane 从 OpenShift Container Platform 3.7(或更新版本)迁移到 OpenShift Container Platform 4.3。CPMA 处理 OpenShift Container Platform 3 配置文件并生成自定义资源 (CR) 清单文件,这些文件由 OpenShift Container Platform 4.3 Operator 使用。

1.7.1. 安装 Control Plane Migration Assistant

您可以从红帽客户门户网站下载 Control Plane Migration Assistant (CPMA) 二进制文件,并在 Linux 、MacOSX 或者 Windows 操作系统中安装它。

流程

  1. Red Hat 客户门户网站中,导航至 DownloadsRed Hat OpenShift Container Platform
  2. Download Red Hat OpenShift Container Platform 页面中,从 Product Variant 列表中选择 Red Hat OpenShift Container Platform
  3. Version 列表中选择 CPMA 1.0 for RHEL 7。这个二进制文件适用于 RHEL 7 和 RHEL 8。
  4. Download Now 为 Linux 或 MacOSX 下载 cpma,或为 Windows 下载 cpma.exe
  5. 对于 Linux 或 MacOSX,把文件保存在由 $PATH 定义的目录中;对于 Windows,把文件保存在由 %PATH% 定义的目录中。
  6. 对于 Linux,把文件设置为可执行:

    $ sudo chmod +x cpma

1.7.2. 使用 Control Plane Migration Assistant

Control Plane Migration Assistant (CPMA) 生成 CR 清单,由 OpenShift Container Platform 4.3 Operator 使用,并产生包括哪些 OpenShift Container Platform 3 的功能被完全支持、部分支持或根本不支持的报告。

CPMA 可在远程模式下运行,使用 SSH 从源集群中检索配置文件,也可以使用本地模式,使用源集群配置文件的本地副本获取配置文件。

先决条件

  • 源集群必须是 OpenShift Container Platform 3.7 或更高版本。
  • 必须将源集群更新至最新的同步版本。
  • 必须在源集群中运行环境健康检查来确定没有诊断错误或警告。
  • CPMA 二进制文件必须是可执行文件。
  • 必须具有源集群的 cluster-admin 权限。

流程

  1. 登陆到 OpenShift Container Platform 3 集群:

    $ oc login https://<master1.example.com> 1
    1
    OpenShift Container Platform 3 主(master)节点。您必须登录到集群以接收 Kubernetes 和 OpenShift Container Platform API 的令牌。
  2. 运行 CPMA。根据每个提示输入,如下例所示:

    $ cpma --manifests=false 1
    ? Do you wish to save configuration for future use? true
    ? What will be the source for OCP3 config files? Remote host 2
    ? Path to crio config file /etc/crio/crio.conf
    ? Path to etcd config file /etc/etcd/etcd.conf
    ? Path to master config file /etc/origin/master/master-config.yaml
    ? Path to node config file /etc/origin/node/node-config.yaml
    ? Path to registries config file /etc/containers/registries.conf
    ? Do wish to find source cluster using KUBECONFIG or prompt it? KUBECONFIG
    ? Select cluster obtained from KUBECONFIG contexts master1-example-com:443
    ? Select master node master1.example.com
    ? SSH login root 3
    ? SSH Port 22
    ? Path to private SSH key /home/user/.ssh/openshift_key
    ? Path to application data, skip to use current directory .
    INFO[29 Aug 19 00:07 UTC] Starting manifest and report generation
    INFO[29 Aug 19 00:07 UTC] Transform:Starting for - API
    INFO[29 Aug 19 00:07 UTC] APITransform::Extract
    INFO[29 Aug 19 00:07 UTC] APITransform::Transform:Reports
    INFO[29 Aug 19 00:07 UTC] Transform:Starting for - Cluster
    INFO[29 Aug 19 00:08 UTC] ClusterTransform::Transform:Reports
    INFO[29 Aug 19 00:08 UTC] ClusterReport::ReportQuotas
    INFO[29 Aug 19 00:08 UTC] ClusterReport::ReportPVs
    INFO[29 Aug 19 00:08 UTC] ClusterReport::ReportNamespaces
    INFO[29 Aug 19 00:08 UTC] ClusterReport::ReportNodes
    INFO[29 Aug 19 00:08 UTC] ClusterReport::ReportRBAC
    INFO[29 Aug 19 00:08 UTC] ClusterReport::ReportStorageClasses
    INFO[29 Aug 19 00:08 UTC] Transform:Starting for - Crio
    INFO[29 Aug 19 00:08 UTC] CrioTransform::Extract
    WARN[29 Aug 19 00:08 UTC] Skipping Crio: No configuration file available
    INFO[29 Aug 19 00:08 UTC] Transform:Starting for - Docker
    INFO[29 Aug 19 00:08 UTC] DockerTransform::Extract
    INFO[29 Aug 19 00:08 UTC] DockerTransform::Transform:Reports
    INFO[29 Aug 19 00:08 UTC] Transform:Starting for - ETCD
    INFO[29 Aug 19 00:08 UTC] ETCDTransform::Extract
    INFO[29 Aug 19 00:08 UTC] ETCDTransform::Transform:Reports
    INFO[29 Aug 19 00:08 UTC] Transform:Starting for - OAuth
    INFO[29 Aug 19 00:08 UTC] OAuthTransform::Extract
    INFO[29 Aug 19 00:08 UTC] OAuthTransform::Transform:Reports
    INFO[29 Aug 19 00:08 UTC] Transform:Starting for - SDN
    INFO[29 Aug 19 00:08 UTC] SDNTransform::Extract
    INFO[29 Aug 19 00:08 UTC] SDNTransform::Transform:Reports
    INFO[29 Aug 19 00:08 UTC] Transform:Starting for - Image
    INFO[29 Aug 19 00:08 UTC] ImageTransform::Extract
    INFO[29 Aug 19 00:08 UTC] ImageTransform::Transform:Reports
    INFO[29 Aug 19 00:08 UTC] Transform:Starting for - Project
    INFO[29 Aug 19 00:08 UTC] ProjectTransform::Extract
    INFO[29 Aug 19 00:08 UTC] ProjectTransform::Transform:Reports
    INFO[29 Aug 19 00:08 UTC] Flushing reports to disk
    INFO[29 Aug 19 00:08 UTC] Report:Added: report.json
    INFO[29 Aug 19 00:08 UTC] Report:Added: report.html
    INFO[29 Aug 19 00:08 UTC] Successfully finished transformations
    1
    --manifests=false:不生成 CR 清单
    2
    Remote host:远程模式
    3
    SSH login:为了访问配置文件,SSH 用户必须在 OpenShift Container Platform 3 集群上具有 sudo 权限。

    如果您没有指定输出目录,CPMA 会在当前目录中创建以下文件和目录:

    • cpma.yaml 文件:运行 CPMA 时提供的配置选项
    • master1.example.com/: master 节点中的配置文件
    • report.json: JSON 格式的报告
    • report.html: HTML 格式的报告
  3. 在浏览器中打开 report.html 文件来查看 CPMA 报告。
  4. 如果生成 CR 清单,将 CR 清单应用到 OpenShift Container Platform 4.3 集群,如下例所示:

    $ oc apply -f 100_CPMA-cluster-config-secret-htpasswd-secret.yaml