8.4. 使用 OpenStackNetConfig 创建 overcloud control plane 网络
您必须在 OpenStackNetConfig 中为 overcloud 最少定义一个 control plane 网络。除了 IP 地址分配外,网络定义还包括 OpenStackNetAttachment 的映射信息。OpenShift Virtualization 使用此信息将任何虚拟机附加到网络。
前提条件
- 确保 OpenShift Container Platform 集群正常运行,并且已正确安装了 director Operator。
-
确保已在工作站上安装了
oc命令行工具。
流程
在工作站上创建一个名为
osnetconfig.yaml的文件。包含 control plane 网络的资源规格,该网络名为ctlplane。例如,使用连接到每个 worker 节点上的enp6s0以太网设备的 control plane 规格如下: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: enp6s0 description: Linux bridge with enp6s0 as a port name: br-osp 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: 172.22.0.250 allocationStart: 172.22.0.100 cidr: 172.22.0.0/24 gateway: 172.22.0.1 attachConfiguration: br-osp # optional: configure static mapping for the networks per nodes. If there is none, a random gets created reservations: controller-0: ipReservations: ctlplane: 172.22.0.120 compute-0: ipReservations: ctlplane: 172.22.0.140在网络规格中设置以下值:
name- 设置为 control plane 网络的名称,即 Control。
nameLower- 设置为 control plane 网络的下级名称,即 ctlplane。
subnets- 设置子网规格。
subnets.name- 设置 control plane 子网的名称,即 ctlplane。
subnets.attachConfiguration- 设置指向哪些附加配置的引用。
subnets.ipv4- 带有 allocationStart、allocationEnd、cidr、gateway 和 optional routes 列表的 ipv4 子网详情(包括目的地和下一跳)
有关本节中可以使用的值的描述,请查看
openstacknetconfigCRD 的自定义资源定义中的规格模式:$ oc describe crd openstacknetconfig配置完网络规格后保存文件。
创建 control plane 网络:
$ oc create -f osnetconfig.yaml -n openstack
验证
查看 control plane 网络的资源:
$ oc get openstacknetconfig/openstacknetconfig