第 14 章 使用 director Operator 部署带有 spine-leaf 配置的节点


使用 spine-leaf networking 架构部署节点,在您的环境中复制大量网络拓扑。目前的限制只允许一个用于 Metal3 的 provisioning 网络。

定义 OpenStackNetConfig 自定义资源,并为 overcloud 网络指定子网。然后,director Operator 会显示配置并创建或更新网络拓扑。

前提条件

  • OpenShift Container Platform 集群可以正常工作,且您已正确安装了 director Operator。
  • 您已在工作站上安装了 oc 命令行工具。

流程

  1. 创建名为 openstacknetconfig.yaml 的配置文件:

    apiVersion: osp-director.openstack.org/v1beta1
    kind: OpenStackNetConfig
    metadata:
      name: openstacknetconfig
    spec:
      attachConfigurations:
        br-osp:
          nodeNetworkConfigurationPolicy:
            nodeSelector:
              node-role.kubernetes.io/worker: ""
            desiredState:
              interfaces:
              - bridge:
                  options:
                    stp:
                      enabled: false
                  port:
                  - name: enp7s0
                description: Linux bridge with enp7s0 as a port
                name: br-osp
                state: up
                type: linux-bridge
                mtu: 1500
        br-ex:
          nodeNetworkConfigurationPolicy:
            nodeSelector:
              node-role.kubernetes.io/worker: ""
            desiredState:
              interfaces:
              - bridge:
                  options:
                    stp:
                      enabled: false
                  port:
                  - name: enp6s0
                description: Linux bridge with enp6s0 as a port
                name: br-ex
                state: up
                type: linux-bridge
                mtu: 1500
      # optional DnsServers list
      dnsServers:
      - 192.168.25.1
      # optional DnsSearchDomains list
      dnsSearchDomains:
      - osptest.test.metalkube.org
      - some.other.domain
      # DomainName of the OSP environment
      domainName: osptest.test.metalkube.org
      networks:
      - name: Control
        nameLower: ctlplane
        subnets:
        - name: ctlplane
          ipv4:
            allocationEnd: 192.168.25.250
            allocationStart: 192.168.25.100
            cidr: 192.168.25.0/24
            gateway: 192.168.25.1
          attachConfiguration: br-osp
      - name: InternalApi
        nameLower: internal_api
        mtu: 1350
        subnets:
        - name: internal_api
          ipv4:
            allocationEnd: 172.17.0.250
            allocationStart: 172.17.0.10
            cidr: 172.17.0.0/24
            routes:
            - destination: 172.17.1.0/24
              nexthop: 172.17.0.1
            - destination: 172.17.2.0/24
              nexthop: 172.17.0.1
          vlan: 20
          attachConfiguration: br-osp
        - name: internal_api_leaf1
          ipv4:
            allocationEnd: 172.17.1.250
            allocationStart: 172.17.1.10
            cidr: 172.17.1.0/24
            routes:
            - destination: 172.17.0.0/24
              nexthop: 172.17.1.1
            - destination: 172.17.2.0/24
              nexthop: 172.17.1.1
          vlan: 21
          attachConfiguration: br-osp
        - name: internal_api_leaf2
          ipv4:
            allocationEnd: 172.17.2.250
            allocationStart: 172.17.2.10
            cidr: 172.17.2.0/24
            routes:
            - destination: 172.17.1.0/24
              nexthop: 172.17.2.1
            - destination: 172.17.0.0/24
              nexthop: 172.17.2.1
          vlan: 22
          attachConfiguration: br-osp
      - name: External
        nameLower: external
        subnets:
        - name: external
          ipv4:
            allocationEnd: 10.0.0.250
            allocationStart: 10.0.0.10
            cidr: 10.0.0.0/24
            gateway: 10.0.0.1
          attachConfiguration: br-ex
      - name: Storage
        nameLower: storage
        mtu: 1350
        subnets:
        - name: storage
          ipv4:
            allocationEnd: 172.18.0.250
            allocationStart: 172.18.0.10
            cidr: 172.18.0.0/24
            routes:
            - destination: 172.18.1.0/24
              nexthop: 172.18.0.1
            - destination: 172.18.2.0/24
              nexthop: 172.18.0.1
          vlan: 30
          attachConfiguration: br-osp
        - name: storage_leaf1
          ipv4:
            allocationEnd: 172.18.1.250
            allocationStart: 172.18.1.10
            cidr: 172.18.1.0/24
            routes:
            - destination: 172.18.0.0/24
              nexthop: 172.18.1.1
            - destination: 172.18.2.0/24
              nexthop: 172.18.1.1
          vlan: 31
          attachConfiguration: br-osp
        - name: storage_leaf2
          ipv4:
            allocationEnd: 172.18.2.250
            allocationStart: 172.18.2.10
            cidr: 172.18.2.0/24
            routes:
            - destination: 172.18.0.0/24
              nexthop: 172.18.2.1
            - destination: 172.18.1.0/24
              nexthop: 172.18.2.1
          vlan: 32
          attachConfiguration: br-osp
      - name: StorageMgmt
        nameLower: storage_mgmt
        mtu: 1350
        subnets:
        - name: storage_mgmt
          ipv4:
            allocationEnd: 172.19.0.250
            allocationStart: 172.19.0.10
            cidr: 172.19.0.0/24
            routes:
            - destination: 172.19.1.0/24
              nexthop: 172.19.0.1
            - destination: 172.19.2.0/24
              nexthop: 172.19.0.1
          vlan: 40
          attachConfiguration: br-osp
        - name: storage_mgmt_leaf1
          ipv4:
            allocationEnd: 172.19.1.250
            allocationStart: 172.19.1.10
            cidr: 172.19.1.0/24
            routes:
            - destination: 172.19.0.0/24
              nexthop: 172.19.1.1
            - destination: 172.19.2.0/24
              nexthop: 172.19.1.1
          vlan: 41
          attachConfiguration: br-osp
        - name: storage_mgmt_leaf2
          ipv4:
            allocationEnd: 172.19.2.250
            allocationStart: 172.19.2.10
            cidr: 172.19.2.0/24
            routes:
            - destination: 172.19.0.0/24
              nexthop: 172.19.2.1
            - destination: 172.19.1.0/24
              nexthop: 172.19.2.1
          vlan: 42
          attachConfiguration: br-osp
      - name: Tenant
        nameLower: tenant
        vip: False
        mtu: 1350
        subnets:
        - name: tenant
          ipv4:
            allocationEnd: 172.20.0.250
            allocationStart: 172.20.0.10
            cidr: 172.20.0.0/24
            routes:
            - destination: 172.20.1.0/24
              nexthop: 172.20.0.1
            - destination: 172.20.2.0/24
              nexthop: 172.20.0.1
          vlan: 50
          attachConfiguration: br-osp
        - name: tenant_leaf1
          ipv4:
            allocationEnd: 172.20.1.250
            allocationStart: 172.20.1.10
            cidr: 172.20.1.0/24
            routes:
            - destination: 172.20.0.0/24
              nexthop: 172.20.1.1
            - destination: 172.20.2.0/24
              nexthop: 172.20.1.1
          vlan: 51
          attachConfiguration: br-osp
        - name: tenant_leaf2
          ipv4:
            allocationEnd: 172.20.2.250
            allocationStart: 172.20.2.10
            cidr: 172.20.2.0/24
            routes:
            - destination: 172.20.0.0/24
              nexthop: 172.20.2.1
            - destination: 172.20.1.0/24
              nexthop: 172.20.2.1
          vlan: 52
          attachConfiguration: br-osp
    Copy to Clipboard Toggle word wrap
  2. 创建内部 API 网络:

    $ oc create -f openstacknetconfig.yaml -n openstack
    Copy to Clipboard Toggle word wrap

验证

  1. 查看 OpenStackNetConfig 的资源和子资源:

    $ oc get openstacknetconfig/openstacknetconfig -n openstack
    $ oc get openstacknetattachment -n openstack
    $ oc get openstacknet -n openstack
    Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat