4.3. 在 OpenShift Container Platform 4.2 到 4.5 上安装旧的 MTC Operator

您可以在 OpenShift Container Platform 版本 4.2 到 4.5 中手动安装旧的 MTC Operator。

先决条件

  • 必须使用在所有集群中具有 cluster-admin 权限的用户登录。
  • 您必须有权访问 registry.redhat.io
  • 必须安装 podman
  • 您必须有一个有网络访问权限的 Linux 工作站才能从 registry.redhat.io 下载文件。
  • 您必须创建 Operator 目录的镜像镜像。
  • 您必须从 OpenShift Container Platform 4.12 上镜像的 Operator 目录安装 MTC Operator。

流程

  1. 使用您的红帽客户门户网站账户登陆到 registry.redhat.io

    $ podman login registry.redhat.io
  2. 输入以下命令下载 operator.yml 文件:

    podman cp $(podman create registry.redhat.io/rhmtc/openshift-migration-legacy-rhel8-operator:v1.7):/operator.yml ./
  3. 输入以下命令下载 controller.yml 文件:

    podman cp $(podman create registry.redhat.io/rhmtc/openshift-migration-legacy-rhel8-operator:v1.7):/controller.yml ./
  4. 运行以下命令来获取 Operator 镜像映射:

    $ grep openshift-migration-legacy-rhel8-operator ./mapping.txt | grep rhmtc

    mapping.txt 文件是在对 Operator 目录进行镜像时创建的。输出显示了 registry.redhat.io 镜像和您的镜像 registry 镜像之间的映射。

    输出示例

    registry.redhat.io/rhmtc/openshift-migration-legacy-rhel8-operator@sha256:468a6126f73b1ee12085ca53a312d1f96ef5a2ca03442bcb63724af5e2614e8a=<registry.apps.example.com>/rhmtc/openshift-migration-legacy-rhel8-operator

  5. operator.yml 文件中,为 ansibleoperator 容器更新 image 值,并更新 REGISTRY 值:

    containers:
      - name: ansible
        image: <registry.apps.example.com>/rhmtc/openshift-migration-legacy-rhel8-operator@sha256:<468a6126f73b1ee12085ca53a312d1f96ef5a2ca03442bcb63724af5e2614e8a> 1
    ...
      - name: operator
        image: <registry.apps.example.com>/rhmtc/openshift-migration-legacy-rhel8-operator@sha256:<468a6126f73b1ee12085ca53a312d1f96ef5a2ca03442bcb63724af5e2614e8a> 2
    ...
        env:
        - name: REGISTRY
          value: <registry.apps.example.com> 3
    1 2
    指定您的镜像 registry 和 Operator 镜像的 sha256 值。
    3
    指定您的镜像 registry。
  6. 登录您的 OpenShift Container Platform 源集群。
  7. 创建 MTC Operator 对象的 Migration Toolkit:

    $ oc create -f operator.yml

    输出示例

    namespace/openshift-migration created
    rolebinding.rbac.authorization.k8s.io/system:deployers created
    serviceaccount/migration-operator created
    customresourcedefinition.apiextensions.k8s.io/migrationcontrollers.migration.openshift.io created
    role.rbac.authorization.k8s.io/migration-operator created
    rolebinding.rbac.authorization.k8s.io/migration-operator created
    clusterrolebinding.rbac.authorization.k8s.io/migration-operator created
    deployment.apps/migration-operator created
    Error from server (AlreadyExists): error when creating "./operator.yml":
    rolebindings.rbac.authorization.k8s.io "system:image-builders" already exists 1
    Error from server (AlreadyExists): error when creating "./operator.yml":
    rolebindings.rbac.authorization.k8s.io "system:image-pullers" already exists

    1
    您可以忽略 Error from server (AlreadyExists) 信息。它们是由 MTC Operator 为早期版本的 OpenShift Container Platform 4 创建资源造成的,这些资源在以后的版本中已提供。
  8. 创建 MigrationController 对象:

    $ oc create -f controller.yml
  9. 验证 MTC Pod 是否正在运行:

    $ oc get pods -n openshift-migration