3.7. 使用多架构计算机器迁移到集群。


您可以通过升级到多架构的有效负载,使用单架构计算机器将当前集群迁移到具有多架构计算机器的集群。这可让您在集群中添加混合架构计算节点。

有关配置多架构计算机器的详情,请参考"在 OpenShift Container Platform 集群上配置多架构计算机器"。

在将单架构集群迁移到使用多架构计算机器的集群前,建议安装 Multiarch Tuning Operator,并部署 ClusterPodPlacementConfig 自定义资源。如需更多信息,请参阅使用 Multiarch Tuning Operator 在多架构集群中管理工作负载

重要

不支持从多架构有效负载迁移到单架构有效负载。集群转换为使用多架构有效负载后,它无法再接受单架构升级有效负载。

先决条件

  • 您可以使用具有 cluster-admin 角色的用户访问集群。
  • 您的 OpenShift Container Platform 版本为至少版本 4.13.0。

    有关如何更新集群版本的更多信息,请参阅使用 Web 控制台更新集群使用 CLI 更新集群

  • 已安装与当前集群版本匹配的 OpenShift CLI (oc)。
  • oc 客户端至少更新至版本 4.13.0。
  • 您的 OpenShift Container Platform 集群安装在 AWS、Azure、GCP、裸机或 IBM P/Z 平台上。

    有关为集群安装选择受支持的平台的更多信息,请参阅选择集群安装类型

流程

  1. 运行以下命令,验证 Cluster Version Operator (CVO) 中的 RetrievedUpdates 条件是否为 True

    $ oc get clusterversion/version -o=jsonpath="{.status.conditions[?(.type=='RetrievedUpdates')].status}"
    Copy to Clipboard Toggle word wrap

    如果 RetrievedUpates 条件为 False,您可以使用以下命令查找有关故障的补充信息:

    $ oc adm upgrade
    Copy to Clipboard Toggle word wrap

    如需有关集群版本状况类型的更多信息,请参阅了解集群版本状况类型

  2. 如果条件 RetrievedUpdatesFalse,使用以下命令将频道改为 stable-<4.y>fast-<4.y>

    $ oc adm upgrade channel <channel>
    Copy to Clipboard Toggle word wrap

    设置频道后,验证 RetrievedUpdates 是否为 True

    有关频道的更多信息,请参阅了解更新频道和发行版本

  3. 使用以下命令迁移到多架构有效负载:

    $ oc adm upgrade --to-multi-arch
    Copy to Clipboard Toggle word wrap

验证

  • 您可以运行以下命令来监控迁移:

    $ oc adm upgrade
    Copy to Clipboard Toggle word wrap

    输出示例

    working towards ${VERSION}: 106 of 841 done (12% complete), waiting on machine-config
    Copy to Clipboard Toggle word wrap

    重要

    机器启动可能会失败,因为集群进入新状态。要在机器启动时注意到和恢复,我们建议部署机器健康检查。有关机器健康检查以及如何部署它们的更多信息,请参阅关于机器健康检查

    1. 可选: 要检索有关更新状态的更多详细信息,请运行以下命令来监控迁移:

      $ oc adm upgrade status
      Copy to Clipboard Toggle word wrap

      有关如何使用 oc adm upgrade status 命令的更多信息,请参阅使用 oc adm upgrade status 获取集群更新状态(技术预览)

迁移必须完成,所有集群操作器都必须稳定,然后才能将具有不同架构的计算机器集添加到集群中。

您可以将集群中的 control plane 从 x86 迁移到 Amazon Web Services (AWS)上的 arm64 架构。

先决条件

  • 已安装 OpenShift CLI(oc)。
  • 以具有 cluster-admin 权限的用户身份登录 oc

流程

  1. 运行以下命令,检查 control plane 节点的构架:

    $ oc get nodes -o wide
    Copy to Clipboard Toggle word wrap

    输出示例

    NAME                          STATUS   ROLES                  AGE    VERSION   INTERNAL-IP EXTERNAL-IP   OS-IMAGE                                         KERNEL-VERSION                 CONTAINER-RUNTIME
    worker-001.example.com        Ready    worker                 100d   v1.30.7   10.x.x.x    <none>        Red Hat Enterprise Linux CoreOS 4xx.xx.xxxxx-0   5.x.x-xxx.x.x.el9_xx.x86_64    cri-o://1.30.x
    worker-002.example.com        Ready    worker                 98d    v1.30.7   10.x.x.x    <none>        Red Hat Enterprise Linux CoreOS 4xx.xx.xxxxx-0   5.x.x-xxx.x.x.el9_xx.x86_64    cri-o://1.30.x
    worker-003.example.com        Ready    worker                 98d    v1.30.7   10.x.x.x    <none>        Red Hat Enterprise Linux CoreOS 4xx.xx.xxxxx-0   5.x.x-xxx.x.x.el9_xx.x86_64    cri-o://1.30.x
    master-001.example.com        Ready    control-plane,master   120d   v1.30.7   10.x.x.x    <none>        Red Hat Enterprise Linux CoreOS 4xx.xx.xxxxx-0   5.x.x-xxx.x.x.el9_xx.x86_64    cri-o://1.30.x
    master-002.example.com        Ready    control-plane,master   120d   v1.30.7   10.x.x.x    <none>        Red Hat Enterprise Linux CoreOS 4xx.xx.xxxxx-0   5.x.x-xxx.x.x.el9_xx.x86_64    cri-o://1.30.x
    master-003.example.com        Ready    control-plane,master   120d   v1.30.7   10.x.x.x    <none>        Red Hat Enterprise Linux CoreOS 4xx.xx.xxxxx-0   5.x.x-xxx.x.x.el9_xx.x86_64    cri-o://1.30.x
    Copy to Clipboard Toggle word wrap

    输出中的 KERNEL-VERSION 字段指示节点的构架。

  2. 运行以下命令,检查集群是否使用多个有效负载:

    $ oc adm release info -o jsonpath="{ .metadata.metadata}"
    Copy to Clipboard Toggle word wrap

    如果您看到以下输出,集群与多架构兼容。

    {
     "release.openshift.io/architecture": "multi",
     "url": "https://access.redhat.com/errata/<errata_version>"
    }
    Copy to Clipboard Toggle word wrap

    如果集群没有使用多个有效负载,将集群迁移到多架构集群。如需更多信息,请参阅"使用多架构计算机器迁移到集群"。

  3. 运行以下命令,将镜像流从单架构更新至多架构:

    $ oc import-image <multiarch_image_stream_tag>  --from=<registry>/<project_name>/<image_name> \
    --import-mode='PreserveOriginal'
    Copy to Clipboard Toggle word wrap
  4. 运行以下命令,获取用于配置 control plane 机器集的 arm64 兼容 Amazon Machine Image (AMI):

    $ oc get configmap/coreos-bootimages -n openshift-machine-config-operator -o jsonpath='{.data.stream}' | jq -r '.architectures.aarch64.images.aws.regions."<aws_region>".image' 
    1
    Copy to Clipboard Toggle word wrap
    1
    <aws_region> 替换为安装当前集群的 AWS 区域。您可以运行以下命令来获取已安装集群的 AWS 区域:
    $ oc get infrastructure cluster -o jsonpath='{.status.platformStatus.aws.region}'
    Copy to Clipboard Toggle word wrap

    输出示例

    ami-xxxxxxx
    Copy to Clipboard Toggle word wrap

  5. 运行以下命令更新 control plane 机器集来支持 arm64 架构:

    $ oc edit controlplanemachineset.machine.openshift.io cluster -n openshift-machine-api
    Copy to Clipboard Toggle word wrap

    instanceType 字段更新为支持 arm64 架构的类型,并将 ami.id 字段设置为与 arm64 架构兼容的 AMI。有关支持的实例类型的详情,请参考 64 位 ARM 基础架构上"为 AWS 测试的实例类型"。

    有关为 AWS 配置 control plane 机器集的更多信息,请参阅 "Control plane configuration options for Amazon Web Services"。

验证

  • 验证 control plane 节点现在是否在 arm64 架构中运行:

    $ oc get nodes -o wide
    Copy to Clipboard Toggle word wrap

    输出示例

    NAME                          STATUS   ROLES                  AGE    VERSION   INTERNAL-IP EXTERNAL-IP   OS-IMAGE                                         KERNEL-VERSION                 CONTAINER-RUNTIME
    worker-001.example.com        Ready    worker                 100d   v1.30.7   10.x.x.x    <none>        Red Hat Enterprise Linux CoreOS 4xx.xx.xxxxx-0   5.x.x-xxx.x.x.el9_xx.x86_64    cri-o://1.30.x
    worker-002.example.com        Ready    worker                 98d    v1.30.7   10.x.x.x    <none>        Red Hat Enterprise Linux CoreOS 4xx.xx.xxxxx-0   5.x.x-xxx.x.x.el9_xx.x86_64    cri-o://1.30.x
    worker-003.example.com        Ready    worker                 98d    v1.30.7   10.x.x.x    <none>        Red Hat Enterprise Linux CoreOS 4xx.xx.xxxxx-0   5.x.x-xxx.x.x.el9_xx.x86_64    cri-o://1.30.x
    master-001.example.com        Ready    control-plane,master   120d   v1.30.7   10.x.x.x    <none>        Red Hat Enterprise Linux CoreOS 4xx.xx.xxxxx-0   5.x.x-xxx.x.x.el9_xx.aarch64   cri-o://1.30.x
    master-002.example.com        Ready    control-plane,master   120d   v1.30.7   10.x.x.x    <none>        Red Hat Enterprise Linux CoreOS 4xx.xx.xxxxx-0   5.x.x-xxx.x.x.el9_xx.aarch64   cri-o://1.30.x
    master-003.example.com        Ready    control-plane,master   120d   v1.30.7   10.x.x.x    <none>        Red Hat Enterprise Linux CoreOS 4xx.xx.xxxxx-0   5.x.x-xxx.x.x.el9_xx.aarch64   cri-o://1.30.x
    Copy to Clipboard Toggle word wrap

您可以在 x86arm64 架构之间迁移 Google Cloud 集群中的 control plane 或 infra 机器集。

先决条件

  • 已安装 OpenShift CLI(oc)。
  • 以具有 cluster-admin 权限的用户身份登录 oc

流程

  1. 运行以下命令,检查 control plane 或 infra 节点的构架:

    $ oc get nodes -o wide
    Copy to Clipboard Toggle word wrap

    输出示例

    NAME                          STATUS   ROLES                  AGE    VERSION   INTERNAL-IP EXTERNAL-IP   OS-IMAGE                                         KERNEL-VERSION                 CONTAINER-RUNTIME
    worker-001.example.com        Ready    infra                 100d   v1.30.7   10.x.x.x    <none>        Red Hat Enterprise Linux CoreOS 4xx.xx.xxxxx-0   5.x.x-xxx.x.x.el9_xx.x86_64    cri-o://1.30.x
    master-001.example.com        Ready    control-plane,master   120d   v1.30.7   10.x.x.x    <none>        Red Hat Enterprise Linux CoreOS 4xx.xx.xxxxx-0   5.x.x-xxx.x.x.el9_xx.x86_64    cri-o://1.30.x
    Copy to Clipboard Toggle word wrap

    输出中的 KERNEL-VERSION 字段指示节点的构架。

  2. 运行以下命令,检查集群是否使用多个有效负载:

    $ oc adm release info -o jsonpath="{ .metadata.metadata}"
    Copy to Clipboard Toggle word wrap

    如果您看到以下输出,集群与多架构兼容。

    {
     "release.openshift.io/architecture": "multi",
     "url": "https://access.redhat.com/errata/<errata_version>"
    }
    Copy to Clipboard Toggle word wrap

    如果集群没有使用多个有效负载,将集群迁移到多架构集群。如需更多信息,请参阅"使用多架构计算机器迁移到集群"。

  3. 如果使用任何自定义镜像流,请通过为每个镜像流运行以下命令来将其从单架构更新至多架构:

    $ oc import-image <multiarch_image_stream_tag>  --from=<registry>/<project_name>/<image_name> \
    --import-mode='PreserveOriginal'
    Copy to Clipboard Toggle word wrap
  4. Compute 引擎的 General-purpose 机器系列 中选择与目标架构匹配的实例类型(Google 文档)。请参阅 Available regions and zones 表(Google 文档),以验证区域中是否支持实例类型。
  5. Compute 引擎的通用机器系列的"支持磁盘类型"部分选择实例类型 支持的磁盘类型(Google 文档)。
  6. 运行以下命令,确定机器集在迁移后使用的 Google Cloud 镜像:

    $ oc get configmap/coreos-bootimages \
      -n openshift-machine-config-operator \
      -o jsonpath='{.data.stream}' | jq \
      -r '.architectures.aarch64.images.gcp'
    Copy to Clipboard Toggle word wrap

    输出示例

    "gcp": {
        "release": "415.92.202309142014-0",
        "project": "rhcos-cloud",
        "name": "rhcos-415-92-202309142014-0-gcp-aarch64"
      }
    Copy to Clipboard Toggle word wrap

    使用输出中的 项目和 名称 参数,以如下格式组成 image 参数: projects/<project>/global/images/<name>

  7. 要将 control plane 迁移到另一个构架,请运行以下命令:

    $ oc edit controlplanemachineset.machine.openshift.io cluster -n openshift-machine-api
    Copy to Clipboard Toggle word wrap
    1. disks.type 参数替换为您选择的磁盘类型。
    2. disks.image 参数替换为您之前制作的 image 参数。
    3. machineType 参数替换为您选择的实例类型。
  8. 要将 infra 机器集迁移到另一个构架,请使用 infra 机器集的 ID 运行以下命令:

    $ oc edit machineset <infra-machine-set_id> -n openshift-machine-api
    Copy to Clipboard Toggle word wrap
    1. disks.type 参数替换为您选择的磁盘类型。
    2. disks.image 参数替换为您之前制作的 image 参数。
    3. machineType 参数替换为您选择的实例类型。
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat