Questo contenuto non è disponibile nella lingua selezionata.
Chapter 6. Route advertisements
6.1. About route advertisements Copia collegamentoCollegamento copiato negli appunti!
This feature provides route advertisement capabilities for the OVN-Kubernetes network plugin. A Border Gateway Router (BGP) provider is required. For more information, see About BGP routing.
6.1.1. Advertise cluster network routes with Border Gateway Protocol Copia collegamentoCollegamento copiato negli appunti!
With route advertisements enabled, the OVN-Kubernetes network plugin supports advertising network routes for the default pod network and cluster user-defined (CUDN) networks to the provider network, including EgressIPs, and importing routes from the provider network to the default pod network and CUDNs. From the provider network, IP addresses advertised from the default pod network and CUDNs can be reached directly.
For example, you can import routes to the default pod network so you no longer need to manually configure routes on each node. Previously, you might have been using local gateway mode (RoutingViaHost=true
) and manually configuring routes on each node to approximate a similar configuration. With route advertisements you can accomplish this seamlessly and you can use shared gateway mode (RoutingViaHost=false
) as well.
Route reflectors on the provider network are supported and can reduce the number of BGP connections required to advertise routes on large networks.
If you use EgressIPs with route advertisements enabled, the layer 3 provider network is aware of EgressIP failovers. This allows you to locate cluster nodes that host EgressIPs on different layer 2 segments whereas before only the layer 2 provider network was aware so that required all the egress nodes to be on the same layer 2 segment.
6.1.1.1. Supported platforms Copia collegamentoCollegamento copiato negli appunti!
Advertising routes with border gateway protocol (BGP) is supported on the following infrastructure types:
- Bare-metal
6.1.1.2. Infrastructure requirements Copia collegamentoCollegamento copiato negli appunti!
To use route advertisements, you must have configured BGP for your network infrastructure. Outages or misconfigurations of your network infrastructure might cause disruptions to your cluster network.
6.1.1.3. Compatibility with other networking features Copia collegamentoCollegamento copiato negli appunti!
Route advertisements support the following OpenShift Container Platform Networking features:
- Multiple external gateways (MEG)
- MEG is not supported with this feature.
- EgressIPs
Supports the use and advertisement of EgressIPs. The node where an egress IP address resides advertises the EgressIP. An egress IP address must be on the same layer 2 network subnet as the egress node. The following limitations apply:
- Advertising EgressIPs from a user-defined network (CUDN) operating in layer 2 mode are not supported.
- Advertising EgressIPs for a network that has both egress IP addresses assigned to the primary network interface and egress IP addresses assigned to additional network interfaces is impractical. All EgressIPs are advertised on all of the BGP sessions of the selected FRRConfiguration instances, regardless of whether these sessions are established over the same interface that the EgressIP is assigned to or not, potentially leading to unwanted advertisements.
- Services
- Works with the MetalLB Operator to advertise services to the provider network.
- Egress service
- Full support.
- Egress firewall
- Full support.
- Egress QoS
- Full support.
- Network policies
- Full support.
- Direct pod ingress
- Full support for the default cluster network and cluster user-defined (CUDN) networks.
6.1.1.4. Considerations for use with the MetalLB Operator Copia collegamentoCollegamento copiato negli appunti!
The MetalLB Operator is installed as an add-on to the cluster. Deployment of the MetalLB Operator automatically enables FRR-K8s as an additional routing capability provider. This feature and the MetalLB Operator use the same FRR-K8s deployment.
6.1.1.5. Considerations for naming cluster user-defined networks (CUDNs) Copia collegamentoCollegamento copiato negli appunti!
When referencing a VRF device in a FRRConfiguration
CR, the VRF name is the same as the CUDN name for VRF names that are less than or equal to 15 characters. It is recommended to use a VRF name no longer than 15 characters so that the VRF name can be inferred from the CUDN name.
6.1.1.6. BGP routing custom resources Copia collegamentoCollegamento copiato negli appunti!
The following custom resources (CRs) are used to configure route advertisements with BGP:
RouteAdvertisements
-
This CR defines the advertisements for the BGP routing. From this CR, the OVN-Kubernetes controller generates a
FRRConfiguration
object that configures the FRR daemon to advertise cluster network routes. This CR is cluster scoped. FRRConfiguration
-
This CR is used to define BGP peers and to configure route imports from the provider network into the cluster network. Before applying
RouteAdvertisements
objects, at least one FRRConfiguration object must be initially defined to configure the BGP peers. This CR is namespaced.
6.1.1.7. OVN-Kubernetes controller generation of FRRConfiguration objects Copia collegamentoCollegamento copiato negli appunti!
An FRRConfiguration
object is generated for each network and node selected by a RouteAdvertisements
CR with the appropriate advertised prefixes that apply to each node. The OVN-Kubernetes controller checks whether the RouteAdvertisements
-CR-selected nodes are a subset of the nodes that are selected by the RouteAdvertisements
-CR-selected FRR configurations.
Any filtering or selection of prefixes to receive are not considered in FRRConfiguration
objects that are generated from the RouteAdvertisement
CRs. Configure any prefixes to receive on other FRRConfiguration
objects. OVN-Kubernetes imports routes from the VRF into the appropriate network.
6.1.1.8. Cluster Network Operator configuration Copia collegamentoCollegamento copiato negli appunti!
The Cluster Network Operator (CNO) API exposes several fields to configure route advertisements:
-
spec.additionalRoutingCapabilities.providers
: Specifies an additional routing provider, which is required to advertise routes. The only supported value isFRR
, which enables deployment of the FRR-K8S daemon for the cluster. When enabled, the FRR-K8S daemon is deployed on all nodes. -
spec.defaultNetwork.ovnKubernetesConfig.routeAdvertisements
: Enables route advertisements for the default cluster network and CUDN networks. Thespec.additionalRoutingCapabilities
field must be set toFRR
to enable this feature.
6.1.2. RouteAdvertisements object configuration Copia collegamentoCollegamento copiato negli appunti!
You can define an RouteAdvertisements
object, which is cluster scoped, with the following properties.
The fields for the RouteAdvertisements
custom resource (CR) are described in the following table:
Field | Type | Description |
---|---|---|
|
|
Specifies the name of the |
|
|
Specifies an array that can contain a list of different types of networks to advertise. Supports only the |
|
|
Determines which |
|
| Specifies which networks to advertise among default cluster network and cluster user defined networks (CUDNs). |
|
|
Limits the advertisements to selected nodes. When |
|
|
Determines which router to advertise the routes in. Routes are advertised on the routers associated with this virtual routing and forwarding (VRF) target, as specified on the selected |
6.1.3. Examples advertising pod IP addresses with BGP Copia collegamentoCollegamento copiato negli appunti!
The following examples describe several configurations for advertising pod IP addresses and EgressIPs with Border Gateway Protocol (BGP). The external network border router has the 172.18.0.5
IP address. These configures assume that you have configured an external route reflector that can relay routes to all nodes on the cluster network.
6.1.3.1. Advertising the default cluster network Copia collegamentoCollegamento copiato negli appunti!
In this scenario, the default cluster network is exposed to the external network so that pod IP addresses and EgressIPs are advertised to the provider network.
This scenario relies upon the following FRRConfiguration
object:
FRRConfiguration
CR
When the OVN-Kubernetes controller sees this RouteAdvertisements
CR, it generates further FRRConfiguration
objects based on the selected ones that configure the FRR daemon to advertise the routes for the default cluster network.
An example of a FRRConfiguration
CR generated by OVN-Kubernetes
In the example generated FRRConfiguration
object, <default_network_host_subnet>
is the subnet of the default cluster network that is advertised to the provider network.
6.1.3.2. Advertising pod IPs from a cluster user-defined network over BGP Copia collegamentoCollegamento copiato negli appunti!
In this scenario, the blue cluster user-defined network (CUDN) is exposed to the external network so that the network’s pod IP addresses and EgressIPs are advertised to the provider network.
This scenario relies upon the following FRRConfiguration
object:
FRRConfiguration
CR
With this FRRConfiguration
object, routes will be imported from neighbor 172.18.0.5
into the default VRF and are available to the default cluster network.
The CUDNs are advertised over the default VRF as illustrated in the following diagram:
- Red CUDN
-
A VRF named
red
associated with a CUDN namedred
-
A subnet of
10.0.0.0/24
-
A VRF named
- Blue CUDN
-
A VRF named
blue
associated with a CUDN namedblue
-
A subnet of
10.0.1.0/24
-
A VRF named
In this configuration, two separate CUDNs are defined. The red network covers the 10.0.0.0/24
subnet and the blue network covers the 10.0.1.0/24
subnet. The red and blue networks are labeled as export: true
.
The following RouteAdvertisements
CR describes the configuration for the red and blue tenants:
RouteAdvertisements
CR for the red and blue tenants
When the OVN-Kubernetes controller sees this RouteAdvertisements
CR, it generates generates further FRRConfiguration
objects based on the selected ones that configure the FRR daemon to advertise the routes. The following example is of one such configuration object, with the number of FRRConfiguration
objects created depending on the node and networks selected.
An example of a FRRConfiguration
CR generated by OVN-Kubernetes
The generated FRRConfiguration
object configures the subnet 10.0.1.0/24
, which belongs to network blue, to be imported into the default VRF and advertised to the 172.18.0.5
neighbor. An FRRConfiguration
object is generated for each network and nodes selected by a RouteAdvertisements
CR with the appropriate prefixes that apply to each node.
When the targetVRF
field is omitted, the routes are leaked and advertised over the default VRF. Additionally, routes that were imported to the default VRF after the definition of the initial FRRConfiguration object are also imported into the blue VRF.
6.1.3.3. Advertising pod IPs from a cluster user-defined network over BGP with VPN Copia collegamentoCollegamento copiato negli appunti!
In this scenario, a VLAN interface is attached to the VRF device associated with the blue network. This setup provides a VRF lite design, where FRR-K8S is used to advertise the blue network only over the corresponding BGP session on the blue network VRF/VLAN link to the next hop Provide Edge (PE) router. The red tenant uses the same configuration. The blue and red networks are labeled as export: true
.
This scenario does not support the use of EgressIPs.
The following diagram illustrates this configuration:
- Red CUDN
-
A VRF named
red
associated with a CUDN namedred
- A VLAN interface attached to the VRF device and connected to the external PE router
-
An assigned subnet of
10.0.2.0/24
-
A VRF named
- Blue CUDN
-
A VRF named
blue
associated with a CUDN namedblue
- A VLAN interface attached to the VRF device and connected to the external PE router
-
An assigned subnet of
10.0.1.0/24
-
A VRF named
This approach is available only when you use OVN-Kubernetes in local gateway mode by setting routingViaHost=true
.
In the following configuration, an additional FRRConfiguration
CR configures peering with the PE router on the blue and red VLANs:
FRRConfiguration
CR manually configured for BGP VPN setup
The following RouteAdvertisements
CR describes the configuration for the blue and red tenants:
RouteAdvertisements
CR for the blue and red tenants
In the RouteAdvertisements
CR, the targetVRF
is set to auto
so that advertisements occur within the VRF device that corresponds to the individual networks that are selected. In this scenario, the pod subnet for blue is advertised over the blue VRF device, and the pod subnet for red is advertised over the red VRF device. Additionally, each BGP session imports routes to only the corresponding CUDN VRF as defined by the initial FRRConfiguration
object.
When the OVN-Kubernetes controller sees this RouteAdvertisements
CR, it generates further FRRConfiguration
objects based on the selected ones that configure the FRR daemon to advertise the routes for the blue and red tenants.
FRRConfiguration
CR generated by OVN-Kubernetes for blue and red tenants
In this scenario, any filtering or selection of routes to receive must be done in the FRRConfiguration
CR that defines peering relationships.
6.2. Enabling route advertisements Copia collegamentoCollegamento copiato negli appunti!
As a cluster administrator, you can configure additional route advertisements for your cluster. You must use the OVN-Kubernetes network plugin.
6.2.1. Enabling route advertisements Copia collegamentoCollegamento copiato negli appunti!
As a cluster administrator, you can enable additional routing support for your cluster.
Prerequisites
-
You have installed the OpenShift CLI (
oc
). -
You are logged in to the cluster as a user with the
cluster-admin
role. - The cluster is installed on compatible infrastructure.
Procedure
To enable a routing provider and additional route advertisements, enter the following command:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.3. Disabling route advertisements Copia collegamentoCollegamento copiato negli appunti!
As a cluster administrator, you can disable additional route advertisements for your cluster.
6.3.1. Disabling route advertisements Copia collegamentoCollegamento copiato negli appunti!
As a cluster administrator, you can disable additional route advertisements for your cluster.
Prerequisites
-
You have installed the OpenShift CLI (
oc
). -
You are logged in to the cluster as a user with the
cluster-admin
role. - The cluster is installed on compatible infrastructure.
Procedure
To disable additional routing support, enter the following command:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.4. Example route advertisements setup Copia collegamentoCollegamento copiato negli appunti!
As a cluster administrator, you can configure the following example route advertisements setup for your cluster. This configuration is intended as a sample that demonstrates how to configure route advertisements.
6.4.1. Sample route advertisements setup Copia collegamentoCollegamento copiato negli appunti!
As a cluster administrator, you can enable Border Gateway Protocol (BGP) routing support for your cluster. This configuration is intended as a sample that demonstrates how to configure route advertisements. The configuration uses route reflection rather than a full mesh setup.
BGP routing is supported only on bare-metal infrastructure.
Prerequisites
-
You installed the OpenShift CLI (
oc
). -
You are logged in to the cluster as a user with
cluster-admin
privileges. - The cluster is installed on bare-metal infrastructure.
- You have a bare-metal system with access to the cluster where you plan to run the FRR daemon container.
Procedure
Confirm that the
RouteAdvertisements
feature gate is enabled by running the following command:oc get featuregate -oyaml | grep -i routeadvertisement
$ oc get featuregate -oyaml | grep -i routeadvertisement
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
- name: RouteAdvertisements
- name: RouteAdvertisements
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the Cluster Network Operator (CNO) by running the following command:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow It might take a few minutes for the CNO to restart all nodes.
Get the IP addresses of the nodes by running the following command:
oc get node -owide
$ oc get node -owide
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Get the default pod network of each node by running the following command:
oc get node <node_name> -o=jsonpath={.metadata.annotations.k8s\\.ovn\\.org/node-subnets}
$ oc get node <node_name> -o=jsonpath={.metadata.annotations.k8s\\.ovn\\.org/node-subnets}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
{"default":["10.129.0.0/23"],"ns1.udn-network-primary-layer3":["10.150.6.0/24"]}
{"default":["10.129.0.0/23"],"ns1.udn-network-primary-layer3":["10.150.6.0/24"]}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On the bare-metal hypervisor, get the IP address for the external FRR container to use by running the following command:
ip -j -d route get <a cluster node's IP> | jq -r '.[] | .dev' | xargs ip -d -j address show | jq -r '.[] | .addr_info[0].local'
$ ip -j -d route get <a cluster node's IP> | jq -r '.[] | .dev' | xargs ip -d -j address show | jq -r '.[] | .addr_info[0].local'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a
frr.conf
file for FRR that includes each node’s IP address, as shown in the following example:Example
frr.conf
configuration fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a file named
daemons
that includes the following content:Example
daemons
configuration fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Save both the
frr.conf
anddaemons
files in the same directory, such as/tmp/frr
. Create an external FRR container by running the following command:
sudo podman run -d --privileged --network host --rm --ulimit core=-1 --name frr --volume /tmp/frr:/etc/frr quay.io/frrouting/frr:9.1.0
$ sudo podman run -d --privileged --network host --rm --ulimit core=-1 --name frr --volume /tmp/frr:/etc/frr quay.io/frrouting/frr:9.1.0
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the following
FRRConfiguration
andRouteAdvertisements
configurations:Create a
receive_all.yaml
file that includes the following content:Example
receive_all.yaml
configuration fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a
ra.yaml
file that includes the following content:Example
ra.yaml
configuration fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Apply the
receive_all.yaml
andra.yaml
files by running the following command:for f in receive_all.yaml ra.yaml; do oc apply -f $f; done
$ for f in receive_all.yaml ra.yaml; do oc apply -f $f; done
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify that the configurations were applied:
Verify that the
FRRConfiguration
configurations were created by running the following command:oc get frrconfiguration -A
$ oc get frrconfiguration -A
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the
RouteAdvertisements
configurations were created by running the following command:oc get ra -A
$ oc get ra -A
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME STATUS default Accepted
NAME STATUS default Accepted
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Get the external FRR container ID by running the following command:
sudo podman ps | grep frr
$ sudo podman ps | grep frr
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
22cfc713890e quay.io/frrouting/frr:9.1.0 /usr/lib/frr/dock... 5 hours ago Up 5 hours ago frr
22cfc713890e quay.io/frrouting/frr:9.1.0 /usr/lib/frr/dock... 5 hours ago Up 5 hours ago frr
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the container ID that you obtained in the previous step to check the BGP neighbor and routes in the external FRR container’s
vtysh
session. Run the following command:sudo podman exec -it <container_id> vtysh -c "show ip bgp"
$ sudo podman exec -it <container_id> vtysh -c "show ip bgp"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Find the
frr-k8s
pod for each cluster node by running the following command:oc -n openshift-frr-k8s get pod -owide
$ oc -n openshift-frr-k8s get pod -owide
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow From the OpenShift Container Platform cluster, check BGP routes on the cluster node’s
frr-k8s
pod in the FRR container by running the following command:oc -n openshift-frr-k8s -c frr rsh frr-k8s-86wmq
$ oc -n openshift-frr-k8s -c frr rsh frr-k8s-86wmq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the IP routes from the cluster node by running the following command:
vtysh
sh-5.1# vtysh
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Hello, this is FRRouting (version 8.5.3). Copyright 1996-2005 Kunihiro Ishiguro, et al.
Hello, this is FRRouting (version 8.5.3). Copyright 1996-2005 Kunihiro Ishiguro, et al.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the IP routes by running the following command:
worker-2# show ip bgp
worker-2# show ip bgp
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow From the OpenShift Container Platform cluster, debug the node by running the following command:
oc debug node/<node_name>
$ oc debug node/<node_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Temporary namespace openshift-debug-lbtgh is created for debugging node... Starting pod/worker-2-debug-zrg4v ... To use host binaries, run `chroot /host` Pod IP: 192.168.111.25 If you don't see a command prompt, try pressing enter.
Temporary namespace openshift-debug-lbtgh is created for debugging node... Starting pod/worker-2-debug-zrg4v ... To use host binaries, run `chroot /host` Pod IP: 192.168.111.25 If you don't see a command prompt, try pressing enter.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Confirm that the BGP routes are being advertised by running the following command:
ip route show | grep bgp
sh-5.1# ip route show | grep bgp
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow