3.3. 为每个命名空间创建数据平面网络


要创建 data plane 网络,请定义一个 NetConfig 自定义资源(CR)并为 data plane 网络指定所有子网。您必须为您的数据平面至少定义一个 control plane 网络。您还可以定义 VLAN 网络,为可组合网络创建网络隔离,如 InternalAPIStorageExternal。每个网络定义必须包含 IP 地址分配。以下流程为 osp_ns_1 命名空间创建一个 NetConfig CR 文件。使用您为该命名空间计划的每个命名空间的 allocationRange 范围重复这个过程。

流程

  1. 在工作站上创建名为 netconfig_osp_ns_1.yaml 的文件。
  2. 将以下配置添加到 netconfig_osp_ns_1.yaml 以创建 NetConfig CR:

    apiVersion: network.openstack.org/v1beta1
    kind: NetConfig
    metadata:
      name: openstacknetconfig
      namespace: osp_ns_1
  3. netconfig_osp_ns_1.yaml 文件中,定义每个 data plane 网络的拓扑。以下示例为数据平面创建隔离网络:

    spec:
      networks:
      - name: CtlPlane
        dnsDomain: ctlplane_1.example.com
        subnets:
        - name: subnet1
          allocationRanges:
          - end: 192.168.122.120
            start: 192.168.122.100
          - end: 192.168.122.200
            start: 192.168.122.150
          cidr: 192.168.122.0/24
          gateway: 192.168.122.1
      - name: InternalApi
        dnsDomain: internalapi_1.example.com
        subnets:
        - name: subnet1
          allocationRanges:
          - end: 172.17.0.250
            start: 172.17.0.100
          excludeAddresses:
          - 172.17.0.10
          - 172.17.0.12
          cidr: 172.17.0.0/24
          vlan: 20
      - name: External
        dnsDomain: external_1.example.com
        subnets:
        - name: subnet1
          allocationRanges:
          - end: 10.0.0.250
            start: 10.0.0.100
          cidr: 10.0.0.0/24
          gateway: 10.0.0.1
      - name: Storage
        dnsDomain: storage_1.example.com
        subnets:
        - name: subnet1
          allocationRanges:
          - end: 172.18.0.250
            start: 172.18.0.100
          cidr: 172.18.0.0/24
          vlan: 21
      - name: Tenant
        dnsDomain: tenant_1.example.com
        subnets:
        - name: subnet1
          allocationRanges:
          - end: 172.19.0.250
            start: 172.19.0.100
          cidr: 172.19.0.0/24
          vlan: 22
    • spec.networks.name :网络的名称,如 CtlPlane
    • spec.networks.subnets :IPv4 子网规格。
    • spec.networks.subnets.name :子网的名称,如 subnet1
    • spec.networks.subnets.allocationRanges: NetConfig allocationRange.allocationRange 不得与 MetalLB IPAddressPool 范围和 IP 地址池范围重叠。
    • spec.networks.subnets.excludeAddresses: 可选的来自 data plane 节点不能使用的分配范围内的 IP 地址列表。
    • spec.networks.subnets.vlan :网络 VLAN。有关默认 RHOSO 网络的信息,请参阅 OpenShift 网络上的默认 Red Hat OpenStack Services
  4. 保存 netconfig_osp_ns_1.yaml 定义文件。
  5. 创建 data plane 网络:

    $ oc create -f netconfig_osp_ns_1.yaml -n openstack
  6. 要验证 data plane 网络是否已创建,请查看 openstacknetconfig 资源:

    $ oc get netconfig/openstacknetconfig -n openstack

    如果您看到错误,请检查底层 network-attach-definition 和节点网络配置策略:

    $ oc get network-attachment-definitions -n openstack
    $ oc get nncp
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

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

让开源更具包容性

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

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部