3.3.2. 为裸机置备服务准备带有隔离网络接口的 RHOCP


创建一个 NodeNetworkConfigurationPolicy (nncp) CR,在 Red Hat OpenShift Container Platform (RHOCP)集群中的每个 worker 节点上配置隔离裸机网络的接口。

流程

  1. 在工作站上创建一个 NodeNetworkConfigurationPolicy (nncp) CR 文件,以便在 RHOCP 集群中的每个 worker 节点上配置隔离裸机网络的接口,例如 baremetal-nncp.yaml。
  2. 检索 RHOCP 集群中 worker 节点的名称:

    $ oc get nodes -l node-role.kubernetes.io/worker -o jsonpath="{.items[*].metadata.name}"
  3. 发现网络配置:

    $ oc get nns/<worker_node> -o yaml | more
    • 将 <worker_node > 替换为在第 2 步中获取的 worker 节点的名称,如 worker-1。为每个 worker 节点重复此步骤。
  4. 在 nncp CR 文件中,在 RHOCP 集群中每个 worker 节点上为隔离的裸机网络配置接口。根据您的网络拓扑选择以下配置之一:

    • 选项 1:专用接口上的 Linux 网桥 - 当您为裸机网络具有专用物理接口时,请使用此配置。

      在以下示例中,nncp CR 配置 worker 节点 1 的 ironic 接口( osp-enp6s0-worker-1 ),以在 eth2 接口上使用 Linux 网桥:

      apiVersion: nmstate.io/v1
      kind: NodeNetworkConfigurationPolicy
      metadata:
       name: osp-enp6s0-worker-1
      spec:
        desiredState:
          interfaces:
          - name: ironic
            type: linux-bridge
            description: Ironic bridge
            bridge:
              options:
                stp:
                  enabled: false
              port:
              - name: eth2
            ipv4:
              address:
              - ip: 172.20.1.10
                prefix-length: "24"
              enabled: true
            ipv6:
              enabled: false
            mtu: 1500
    • 选项 2:共享接口上的 VLAN 接口 - 当您需要使用 VLAN 标记与多个网络共享物理接口时,请使用此配置。

      在以下示例中,nncp CR 在 ospbr 接口上配置一个名为 ironic 的 VLAN 接口,其 VLAN ID 为 101:

      apiVersion: nmstate.io/v1
      kind: NodeNetworkConfigurationPolicy
      metadata:
       name: osp-enp6s0-worker-1
      spec:
        desiredState:
          interfaces:
          - description: ironic vlan interface on ospbr
            ipv4:
              address:
              - ip: 172.20.1.10
                prefix-length: "24"
              dhcp: false
              enabled: true
            ipv6:
              enabled: false
            mtu: 1442
            name: ironic
            state: up
            type: vlan
            vlan:
              base-iface: ospbr
              id: "101"
              reorder-headers: true
  5. 在集群中创建 nncp CR:

    $ oc apply -f baremetal-nncp.yaml
  6. 验证 nncp CR 是否已创建:

    $ oc get nncp -w
    NAME                        STATUS        REASON
    osp-enp6s0-worker-1   Progressing   ConfigurationProgressing
    osp-enp6s0-worker-1   Progressing   ConfigurationProgressing
    osp-enp6s0-worker-1   Available     SuccessfullyConfigured
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

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

让开源更具包容性

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

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部