3.3.2. 为裸机置备服务准备带有隔离网络接口的 RHOCP
创建一个 NodeNetworkConfigurationPolicy (nncp) CR,在 Red Hat OpenShift Container Platform (RHOCP)集群中的每个 worker 节点上配置隔离裸机网络的接口。
流程
-
在工作站上创建一个
NodeNetworkConfigurationPolicy(nncp) CR 文件,以便在 RHOCP 集群中的每个 worker 节点上配置隔离裸机网络的接口,例如baremetal-nncp.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 节点上为隔离的裸机网络配置接口。根据您的网络拓扑选择以下配置之一:选项 1:专用接口上的 Linux 网桥 - 当您为裸机网络具有专用物理接口时,请使用此配置。
在以下示例中,
nncpCR 配置 worker 节点 1 的ironic接口(osp-enp6s0-worker-1),以在 eth2 接口上使用 Linux 网桥:apiVersion: nmstate.io/v1 kind: NodeNetworkConfigurationPolicy metadata: name: osp-enp6s0-worker-1 spec: desiredState: interfaces: - name: ironic type: linux-bridge description: Ironic bridge bridge: options: stp: enabled: false port: - name: eth2 ipv4: address: - ip: 172.20.1.10 prefix-length: "24" enabled: true ipv6: enabled: false mtu: 1500选项 2:共享接口上的 VLAN 接口 - 当您需要使用 VLAN 标记与多个网络共享物理接口时,请使用此配置。
在以下示例中,
nncpCR 在 ospbr 接口上配置一个名为ironic的 VLAN 接口,其 VLAN ID 为 101:apiVersion: nmstate.io/v1 kind: NodeNetworkConfigurationPolicy metadata: name: osp-enp6s0-worker-1 spec: desiredState: interfaces: - description: ironic vlan interface on ospbr ipv4: address: - ip: 172.20.1.10 prefix-length: "24" dhcp: false enabled: true ipv6: enabled: false mtu: 1442 name: ironic state: up type: vlan vlan: base-iface: ospbr id: "101" reorder-headers: true
在集群中创建
nncpCR:$ oc apply -f baremetal-nncp.yaml验证
nncpCR 是否已创建:$ oc get nncp -w NAME STATUS REASON osp-enp6s0-worker-1 Progressing ConfigurationProgressing osp-enp6s0-worker-1 Progressing ConfigurationProgressing osp-enp6s0-worker-1 Available SuccessfullyConfigured