4.4.2. 使用 BGP 的隔离网络接口准备 RHOCP


创建一个 NodeNetworkConfigurationPolicy (nncp)自定义资源(CR),以便在 Red Hat OpenShift Container Platform (RHOCP)集群中的每个 worker 节点上为每个隔离网络配置接口。

流程

  1. 在工作站上创建一个 NodeNetworkConfigurationPolicy (nncp) CR 文件,例如 openstack-nncp-bgp.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 节点上为每个隔离网络配置接口。

    在以下示例中,nncp CR 配置用于映射 Red Hat OpenStack Services on OpenShift (RHOSO)网络的多个未连接的网桥。您可以使用 BGP 接口与网络光纤对等,并建立连接。环回接口配置了 BGP 网络源地址 99.99.0.x。您可以选择将 NIC 专用于 ctlplane 网络。

    apiVersion: nmstate.io/v1
    kind: NodeNetworkConfigurationPolicy
    metadata:
      labels:
        osp/nncm-config-type: standard
      name: worker-0
      namespace: openstack
    spec:
      desiredState:
        dns-resolver:
          config:
            search: []
            server:
            - 192.168.122.1
        interfaces:
        - description: internalapi bridge
          mtu: 1500
          name: internalapi
          state: up
          type: linux-bridge
          ipv4:
            address:
            - ip: 172.17.0.1
              prefix-length: 24
          enabled: true
        - description: storage bridge
          mtu: 1500
          name: storage
          state: up
          type: linux-bridge
          ipv4:
            address:
            - ip: 172.18.0.1
              prefix-length: 24
          enabled: true
        - description: ctlplane bridge
          mtu: 1500
          name: ospbr
          state: up
          type: linux-bridge
        - description: BGP interface 1
          ipv4:
            address:
            - ip: 100.64.0.14
              prefix-length: "30"
            dhcp: false
            enabled: true
          ipv6:
            enabled: false
          mtu: 1500
          name: enp8s0
          state: up
          type: ethernet
        - description: BGP interface 2
          ipv4:
            address:
            - ip: 100.65.0.14
              prefix-length: "30"
            dhcp: false
            enabled: true
          ipv6:
            enabled: false
          mtu: 1500
          name: enp9s0
          state: up
          type: ethernet
        - description: loopback interface
          ipv4:
            address:
            - ip: 99.99.0.3
              prefix-length: "32"
            dhcp: false
            enabled: true
          mtu: 65536
          name: lo
          state: up
        route-rules:
          config: []
        routes:
          config:
          - destination: 99.99.0.0/16
            next-hop-address: 100.64.0.13
            next-hop-interface: enp8s0
            weight: 200
          - destination: 99.99.0.0/16
            next-hop-address: 100.65.0.13
            next-hop-interface: enp9s0
            weight: 200
      nodeSelector:
        kubernetes.io/hostname: worker-0
        node-role.kubernetes.io/worker: ""
  5. 在集群中创建 nncp CR:

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

    $ oc get nncp -w
    输出示例
    NAME       STATUS        REASON
    worker-0   Progressing   ConfigurationProgressing
    worker-0   Progressing   ConfigurationProgressing
    worker-0   Available     SuccessfullyConfigured
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

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

让开源更具包容性

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

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部