4.2. RHOSO ネットワーク用の RHOCP の準備
Red Hat OpenStack Services on OpenShift (RHOSO) サービスは、Red Hat OpenShift Container Platform (RHOCP) のワークロードとして実行されます。NMState Operator を使用して、必要な分離ネットワークにワーカーノードを接続します。必要に応じて、各分離ネットワークに NetworkAttachmentDefinition (net-attach-def) カスタムリソース (CR) を作成し、分離ネットワークにサービス Pod を割り当てます。MetalLB Operator を使用して、分離ネットワーク上の内部サービスエンドポイントを公開します。デフォルトでは、パブリックサービスエンドポイントは RHOCP ルートとして公開されます。
手順
-
ワークステーションに
NodeNetworkConfigurationPolicy(nncp) CR ファイル (例:openstack-nncp.yaml) を作成します。 RHOCP クラスター内のワーカーノードの名前を取得します。
$ 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-1) に置き換えます。各ワーカーノードに対してこの手順を繰り返します。
-
nncpCR ファイルで、RHOCP クラスター内の各ワーカーノードの分離ネットワークそれぞれのインターフェイスを設定します。ネットワーク分離を設定する必要があるデフォルトの物理データセンターネットワークの詳細は、デフォルトの Red Hat OpenStack Services on OpenShift ネットワーク を参照してください。次の例では、
nncpCR は、ワーカーノード 1 (osp-enp6s0-worker-1) のenp6s0インターフェイスを設定して、ネットワーク分離のために IPv4 アドレスを持つ VLAN インターフェイスを使用します。apiVersion: nmstate.io/v1 kind: NodeNetworkConfigurationPolicy metadata: name: osp-enp6s0-worker-1 spec: desiredState: interfaces: - description: internalapi vlan interface ipv4: address: - ip: 172.17.0.10 prefix-length: 24 enabled: true dhcp: false ipv6: enabled: false name: internalapi state: up type: vlan vlan: base-iface: enp6s0 id: 20 reorder-headers: true - description: storage vlan interface ipv4: address: - ip: 172.18.0.10 prefix-length: 24 enabled: true dhcp: false ipv6: enabled: false name: storage state: up type: vlan vlan: base-iface: enp6s0 id: 21 reorder-headers: true - description: tenant vlan interface ipv4: address: - ip: 172.19.0.10 prefix-length: 24 enabled: true dhcp: false ipv6: enabled: false name: tenant state: up type: vlan vlan: base-iface: enp6s0 id: 22 reorder-headers: true - description: Configuring enp6s0 ipv4: address: - ip: 192.168.122.10 prefix-length: 24 enabled: true dhcp: false ipv6: enabled: false mtu: 1500 name: enp6s0 state: up type: ethernet nodeSelector: kubernetes.io/hostname: worker-1 node-role.kubernetes.io/worker: ""nncpCR ファイルで、RHOCP クラスター内の各ワーカーノード上の分離されたネットワークごとにルーティング設定を追加します。apiVersion: nmstate.io/v1 kind: NodeNetworkConfigurationPolicy metadata: name: osp-enp6s0-worker-1 namespace: openstack spec: desiredState: interfaces: <....> routes: config: - destination: 192.168.123.0/24 metric: 150 next-hop-address: 192.168.122.1 next-hop-interface: enp6s0 - destination: 192.168.124.0/24 metric: 150 next-hop-address: 192.168.122.1 next-hop-interface: enp6s0 - destination: 172.17.1.0/24 metric: 150 next-hop-address: 172.17.0.1 next-hop-interface: internalapi - destination: 172.17.2.0/24 metric: 150 next-hop-address: 172.17.0.1 next-hop-interface: internalapi - destination: 172.18.1.0/24 metric: 150 next-hop-address: 172.18.0.1 next-hop-interface: storage - destination: 172.18.2.0/24 metric: 150 next-hop-address: 172.18.0.1 next-hop-interface: storage - destination: 172.19.1.0/24 metric: 150 next-hop-address: 172.19.0.1 next-hop-interface: tenant - destination: 172.19.2.0/24 metric: 150 next-hop-address: 172.19.0.1 next-hop-interface: tenantクラスターに
nncpCR を作成します。$ oc apply -f openstack-nncp.yamlnncpCR が作成されたことを確認します。$ 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-
ワークステーションに
NetworkAttachmentDefinition(net-attach-def) CR ファイル (例:openstack-net-attach-def.yaml) を作成します。 NetworkAttachmentDefinitionCR ファイルで、分離されたネットワークごとにNetworkAttachmentDefinitionリソースを設定して、各ネットワークのルーティング設定を含むサービスデプロイメント Pod をネットワークに接続します。次の例では、macvlanタイプのctlplaneネットワークのNetworkAttachmentDefinitionリソースを作成します。apiVersion: k8s.cni.cncf.io/v1 kind: NetworkAttachmentDefinition metadata: name: ctlplane namespace: openstack1 spec: config: | { "cniVersion": "0.3.1", "name": "ctlplane", "type": "macvlan", "master": "enp6s0",2 "ipam": {3 "type": "whereabouts", "range": "192.168.122.0/24", "range_start": "192.168.122.30",4 "range_end": "192.168.122.70", "routes": [ { "dst": "192.168.123.0/24",5 "gw": "192.168.122.1"6 }, { "dst": "192.168.124.0/24", "gw": "192.168.122.1" } ] } }クラスターに
NetworkAttachmentDefinitionCR を作成します。$ oc apply -f openstack-net-attach-def.yamlNetworkAttachmentDefinitionCR が作成されたことを確認します。$ oc get net-attach-def -n openstack