4.4.2. 使用 BGP 的隔离网络接口准备 RHOCP
创建一个 NodeNetworkConfigurationPolicy (nncp)自定义资源(CR),以便在 Red Hat OpenShift Container Platform (RHOCP)集群中的每个 worker 节点上为每个隔离网络配置接口。
流程
-
在工作站上创建一个
NodeNetworkConfigurationPolicy(nncp) CR 文件,例如openstack-nncp-bgp.yaml。 检索 RHOCP 集群中 worker 节点的名称:
$ oc get nodes -l node-role.kubernetes.io/worker -o jsonpath="{.items[*].metadata.name}"发现网络配置:
$ oc get nns/<worker_node> -o yaml | more-
将
<worker_node> 替换为在第 2 步中获取的 worker 节点的名称,如worker-1。为每个 worker 节点重复此步骤。
-
将
在
nncpCR 文件中,在 RHOCP 集群中每个 worker 节点上为每个隔离网络配置接口。在以下示例中,
nncpCR 配置用于映射 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: ""在集群中创建
nncpCR:$ oc apply -f openstack-nncp-bgp.yaml验证
nncpCR 是否已创建:$ oc get nncp -w- 输出示例
NAME STATUS REASON worker-0 Progressing ConfigurationProgressing worker-0 Progressing ConfigurationProgressing worker-0 Available SuccessfullyConfigured