10.4. control plane 机器集配置


使用 control plane 机器集自动管理和恢复集群中的 control plane 机器。

使用此示例 YAML 作为在任何受支持的平台上创建或修改 control plane 机器集配置的起点。

ControlPlaneMachineSet CR YAML 文件示例

apiVersion: machine.openshift.io/v1
kind: ControlPlaneMachineSet
metadata:
  name: cluster
  namespace: openshift-machine-api
spec:
  replicas: 3
  selector:
    matchLabels:
      machine.openshift.io/cluster-api-cluster: <cluster_id>
      machine.openshift.io/cluster-api-machine-role: master
      machine.openshift.io/cluster-api-machine-type: master
  state: Active
  strategy:
    type: RollingUpdate
  template:
    machineType: machines_v1beta1_machine_openshift_io
    machines_v1beta1_machine_openshift_io:
      failureDomains:
        platform: <platform>
        <platform_failure_domains>
      metadata:
        labels:
          machine.openshift.io/cluster-api-cluster: <cluster_id>
          machine.openshift.io/cluster-api-machine-role: master
          machine.openshift.io/cluster-api-machine-type: master
      spec:
        providerSpec:
          value:
            <platform_provider_spec>

其中:

name: cluster
指定 ControlPlaneMachineSet CR 的名称,即 集群。不要更改这个值。
replicas: 3
指定 control plane 机器的数量。仅支持具有三个 control plane 机器的集群,因此 replicas 值为 3。不支持水平扩展。不要更改这个值。
<cluster_id>

指定基于置备集群时所设置的集群 ID 的基础架构 ID。在创建 ControlPlaneMachineSet CR 时,您必须指定这个值。如果已安装 OpenShift CLI(oc)软件包,您可以通过运行以下命令来获取基础架构 ID:

$ oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster
state: Active

指定 Operator 的状态。当状态为 Inactive 时,Operator 无法正常工作。您可以通过将值设置为 Active 来激活 Operator。

重要

在激活 Operator 前,您必须确保 ControlPlaneMachineSet CR 配置适合您的集群要求。有关激活 Control Plane Machine Set Operator 的更多信息,请参阅"使用 control plane 机器集入门"。

type: RollingUpdate
指定集群的更新策略。允许的值是 OnDelete 和 RollingUpdate。默认值为 RollingUpdate。有关更新策略的更多信息,请参阅"更新 control plane 配置"。
platform: <platform>
指定云供应商平台名称。不要更改这个值。
<platform_failure_domains>
指定集群的故障域配置。本节的格式和值特定于提供程序。如需更多信息,请参阅您的云供应商的故障域配置示例。
<platform_provider_spec>
指定集群的供应商 spec 配置。本节的格式和值特定于提供程序。如需更多信息,请参阅云供应商的供应商规格示例。
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

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

让开源更具包容性

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

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部