4.5. BGP のデータプレーンネットワークの作成
データプレーンネットワークを作成するには、NetConfig カスタムリソース (CR) を定義し、データプレーンネットワークのすべてのサブネットを指定します。データプレーン用に少なくとも 1 つのコントロールプレーンネットワークを定義する必要があります。各ネットワーク定義には IP アドレスの割り当てを含める必要があります。
NetConfig CRD 定義と仕様スキーマを表示するには、次のコマンドを使用します。
$ oc describe crd netconfig
$ oc explain netconfig.spec
手順
-
ワークステーションに
netconfig_bgp.yamlという名前のファイルを作成します。 NetConfigCR を作成するには、netconfig_bgp.yamlに次の設定を追加します。apiVersion: network.openstack.org/v1beta1 kind: NetConfig metadata: name: bgp-netconfig namespace: openstacknetconfig_bgp.yamlファイルで、各データプレーンネットワークのトポロジーを定義します。デフォルトの Red Hat OpenStack Services on OpenShift (RHOSO) ネットワークを使用するには、各ネットワークの仕様を定義する必要があります。デフォルトの RHOSO ネットワークの詳細は、BGP 用のデフォルトの Red Hat OpenStack Services on OpenShift ネットワーク を参照してください。次の例では、データプレーン用の分離ネットワークを作成します。注記この手順と後の手順の例では、IPv4 アドレスのみが含まれています。ただし、RHOSO は IPv6 アドレスもサポートします。
apiVersion: network.openstack.org/v1beta1 kind: NetConfig metadata: name: bgp-netconfig namespace: openstack spec: networks: - name: ctlplane dnsDomain: ctlplane.example.com serviceNetwork: ctlplane mtu: 1500 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: subnet2 allocationRanges: - end: 192.168.123.120 start: 192.168.123.100 - end: 192.168.123.200 start: 192.168.123.150 cidr: 192.168.123.0/24 gateway: 192.168.123.1 - name: subnet3 allocationRanges: - end: 192.168.124.120 start: 192.168.124.100 - end: 192.168.124.200 start: 192.168.124.150 cidr: 192.168.124.0/24 gateway: 192.168.124.1-
spec.networks.name: ネットワークの名前 (例:ctlplane)。 -
spec.networks.subnets: IPv4 サブネット仕様。 -
spec.networks.subnets.name: サブネットの名前 (例:subnet1)。 -
spec.networks.subnets.allocationRanges:NetConfigallocationRange。allocationRangeが、MetalLBIPAddressPoolの範囲および IP アドレスプール範囲と重複しないようにしてください。 -
spec.networks.subnets.vlan: ネットワーク VLAN。デフォルトの RHOSO ネットワークの詳細は、BGP 用のデフォルトの Red Hat OpenStack Services on OpenShift ネットワーク を参照してください。
-
netconfig_bgp.yamlファイルで、各ゾーン内で接続を確立するネットワークインターフェイスを定義します。次の例では、eth2用のbgpnet0と `eth3 用のbgpnet1の 2 つのネットワークインターフェイスを定義し、各ゾーンにサブネットを設定します。- name: bgpnet0 dnsDomain: bgpnet0.example.com serviceNetwork: bgpnet0 mtu: 1500 subnets: - name: subnet0 allocationRanges: - end: 100.64.0.36 start: 100.64.0.1 cidr: 100.64.0.0/24 gateway: 100.64.0.1 routes: - destination: 0.0.0.0/0 nexthop: 100.64.0.1 - name: subnet1 allocationRanges: - end: 100.64.1.36 start: 100.64.1.1 cidr: 100.64.1.0/24 gateway: 100.64.1.1 routes: - destination: 0.0.0.0/0 nexthop: 100.64.1.1 - name: subnet2 allocationRanges: - end: 100.64.2.36 start: 100.64.2.1 cidr: 100.64.2.0/24 gateway: 100.64.2.1 routes: - destination: 0.0.0.0/0 nexthop: 100.64.2.1 - name: bgpnet1 dnsDomain: bgpnet1.example.com serviceNetwork: bgpnet1 mtu: 1500 subnets: - name: subnet0 allocationRanges: - end: 100.65.0.36 start: 100.65.0.1 cidr: 100.65.0.0/24 gateway: 100.65.0.1 routes: - destination: 0.0.0.0/0 nexthop: 100.65.0.1 - name: subnet1 allocationRanges: - end: 100.65.1.36 start: 100.65.1.1 cidr: 100.65.1.0/24 gateway: 100.65.1.1 routes: - destination: 0.0.0.0/0 nexthop: 100.65.1.1 - name: subnet2 allocationRanges: - end: 100.65.2.36 start: 100.65.2.1 cidr: 100.65.2.0/24 gateway: 100.65.2.1 routes: - destination: 0.0.0.0/0 nexthop: 100.65.2.1-
name: bgpnet0: データプレーンノードが BGP ピアと通信するために使用するネットワーク。 -
name: bgpnet1: データプレーンノードが BGP ピアと通信するために使用するネットワーク。
-
netconfig_bgp.yamlファイルで、各ノードが相互に通信するために使用するループバックインターフェイスbgpmainnetの IP アドレスを設定します。- name: bgpmainnet dnsDomain: bgpmainnet.example.com serviceNetwork: bgpmainnet mtu: 1500 subnets: - name: subnet0 allocationRanges: - end: 99.99.0.36 start: 99.99.0.2 cidr: 99.99.0.0/24 - name: subnet1 allocationRanges: - end: 99.99.1.36 start: 99.99.1.2 cidr: 99.99.1.0/24 - name: subnet2 allocationRanges: - end: 99.99.2.36 start: 99.99.2.2 cidr: 99.99.2.0/24- `netconfig_bgp.yaml` 定義ファイルを保存します。
データプレーンネットワークを作成します。
$ oc create -f netconfig_bgp.yaml -n openstackBGP 経由で Pod の IP アドレスをアナウンスするために、
bgpconfig.ymlという名前のBGPConfigurationCR ファイルを作成します。apiVersion: network.openstack.org/v1beta1 kind: BGPConfiguration metadata: name: bgpconfiguration namespace: openstack spec: {}各 Pod に必要な FRR 設定を作成するために、
BGPConfigurationCR を作成します。$ oc create -f bgpconfig.yml
検証
データプレーンネットワークが作成されたことを確認します。
$ oc get netconfig/openstacknetconfig -n openstackエラーが表示された場合は、基礎となる
network-attach-definitionとノードのネットワーク設定ポリシーを確認してください。$ oc get network-attachment-definitions -n openstack $ oc get nncp