Skip to content

Commit e43cead

Browse files
authored
Merge pull request #112391 from kquinn1204/test-symmetric-routing-metallb
OCPBUGS-86705: Hybrid cluster network cited instead of cluster network for metallb+vrf symmetric NNCP config
2 parents 469f87e + 7128107 commit e43cead

1 file changed

Lines changed: 39 additions & 9 deletions

File tree

modules/nw-metallb-configure-return-traffic-proc.adoc

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The example in the procedure associates a VRF routing table with MetalLB and an
1313

1414
[IMPORTANT]
1515
====
16-
* If you use the `sourceIPBy: "LoadBalancerIP"` setting in the `EgressService` CR, you must specify the load-balancer node in the `BGPAdvertisement` custom resource (CR).
16+
* If you use the `sourceIPBy: "LoadBalancerIP"` setting in the `EgressService` CR, you must specify the `LoadBalancer` node in the `BGPAdvertisement` custom resource (CR).
1717
1818
* You can use the `sourceIPBy: "Network"` setting on clusters that use OVN-Kubernetes configured with the `gatewayConfig.routingViaHost` specification set to `true` only. Additionally, if you use the `sourceIPBy: "Network"` setting, you must schedule the application workload on nodes configured with the network VRF instance.
1919
====
@@ -24,9 +24,20 @@ The example in the procedure associates a VRF routing table with MetalLB and an
2424
* Log in as a user with `cluster-admin` privileges.
2525
* Install the Kubernetes NMState Operator.
2626
* Install the MetalLB Operator.
27+
* Create a namespace for your application workload. The examples in this procedure use a namespace called `test`.
2728
2829
.Procedure
2930

31+
. Label the nodes that you want to participate in the VRF configuration by running the following command:
32+
+
33+
[source,terminal]
34+
----
35+
$ oc label node <node_name> vrf=true
36+
----
37+
+
38+
The examples in this procedure use the label `vrf: "true"`.
39+
40+
3041
. Create a `NodeNetworkConfigurationPolicy` CR to define the VRF instance:
3142
+
3243
.. Create a file, such as `node-network-vrf.yaml`, with content like the following example:
@@ -71,7 +82,7 @@ spec:
7182
- ip-to: 172.30.0.0/16
7283
priority: 998
7384
route-table: 254
74-
- ip-to: 10.132.0.0/14
85+
- ip-to: 10.128.0.0/14
7586
priority: 998
7687
route-table: 254
7788
- ip-to: 169.254.0.0/17
@@ -88,7 +99,7 @@ where:
8899
`interfaces.type`:: Specifies the type of interface. This example creates a VRF instance.
89100
`vrf.port`:: Specifies the node interface that the VRF attaches to.
90101
`vrf.route-table-id`:: Specifies the name of the route table ID for the VRF.
91-
`interfaces.name.ens4 `:: Specifies the IPv4 address of the interface associated with the VRF.
102+
`interfaces.name.ens4`:: Specifies the IPv4 address of the interface associated with the VRF.
92103
`routes`:: Specifies the configuration for network routes. The `next-hop-address` field defines the IP address of the next hop for the route. The `next-hop-interface` field defines the outgoing interface for the route. In this example, the VRF routing table is `2`, which references the ID that you define in the `EgressService` CR.
93104
`route-rules`:: Specifies additional route rules. The `ip-to` fields must match the `Cluster Network` CIDR, `Service Network` CIDR, and `Internal Masquerade` subnet CIDR. You can view the values for these CIDR address specifications by running the following command: `oc describe network.operator/cluster`.
94105
`route-rules.route-table`:: Specifies the main routing table that the Linux kernel uses when calculating routes has the ID `254`.
@@ -99,6 +110,15 @@ where:
99110
----
100111
$ oc apply -f node-network-vrf.yaml
101112
----
113+
+
114+
.. Verify that the policy is applied by running the following command:
115+
+
116+
[source,terminal]
117+
----
118+
$ oc get nncp vrfpolicy
119+
----
120+
+
121+
The output must show `Available` in the `STATUS` column before you continue to the next step.
102122

103123
. Create a `BGPPeer` custom resource (CR):
104124
+
@@ -179,7 +199,7 @@ spec:
179199
where:
180200
+
181201
`peers`:: In this example, MetalLB advertises a range of IP addresses from the `first-pool` IP address pool to the `frrviavrf` BGP peer.
182-
`nodeSelectors`:: In this example, the `EgressService` CR configures the source IP address for egress traffic to use the load-balancer service IP address. Therefore, you must specify the load-balancer node for return traffic to use the same return path for the traffic originating from the pod.
202+
`nodeSelectors`:: In this example, the `EgressService` CR configures the source IP address for egress traffic to use the `LoadBalancer` service IP address. Therefore, you must specify the `LoadBalancer` node for return traffic to use the same return path for the traffic originating from the pod.
183203
+
184204
.. Apply the configuration for the BGP advertisement by running the following command:
185205
+
@@ -210,11 +230,11 @@ spec:
210230
+
211231
where:
212232
+
213-
`metadata.name`:: Specifies the name for the egress service. The name of the `EgressService` resource must match the name of the load-balancer service that you want to modify.
214-
`metadata.namespace`:: Specifies the namespace for the egress service. The namespace for the `EgressService` must match the namespace of the load-balancer service that you want to modify. The egress service is namespace-scoped.
233+
`metadata.name`:: Specifies the name for the egress service. The name of the `EgressService` resource must match the name of the `LoadBalancer` service that you want to modify.
234+
`metadata.namespace`:: Specifies the namespace for the egress service. The namespace for the `EgressService` must match the namespace of the `LoadBalancer` service that you want to modify. The egress service is namespace-scoped.
215235
`spec.sourceIPBy`:: Specifies the `LoadBalancer` service ingress IP address as the source IP address for egress traffic.
216236
`matchLabels.vrf`:: If you specify `LoadBalancer` for the `sourceIPBy` specification, a single node handles the `LoadBalancer` service traffic. In this example, only a node with the label `vrf: "true"` can handle the service traffic. If you do not specify a node, OVN-Kubernetes selects a worker node to handle the service traffic. When a node is selected, OVN-Kubernetes labels the node in the following format: `egress-service.k8s.ovn.org/<svc_namespace>-<svc_name>: ""`.
217-
`network`:: Specifyies the routing table ID for egress traffic. Ensure that the value matches the `route-table-id` ID defined in the `NodeNetworkConfigurationPolicy` resource, for example, `route-table-id: 2`.
237+
`network`:: Specifies the routing table ID for egress traffic. Ensure that the value matches the `route-table-id` ID defined in the `NodeNetworkConfigurationPolicy` resource, for example, `route-table-id: 2`.
218238
+
219239
.. Apply the configuration for the egress service by running the following command:
220240
+
@@ -225,12 +245,22 @@ $ oc apply -f egress-service.yaml
225245

226246
.Verification
227247

248+
. Get the external IP address for the `LoadBalancer` service by running the following command:
249+
+
250+
[source,terminal]
251+
----
252+
$ oc get svc <service_name> -n <namespace>
253+
----
254+
+
255+
where `<service_name>` is the name of your `LoadBalancer` service and `<namespace>` is the namespace where the service is deployed. Note the `EXTERNAL-IP` value from the output.
256+
228257
. Verify that you can access the application endpoint of the pods running behind the MetalLB service by running the following command:
229258
+
230259
[source,terminal]
231260
----
232261
$ curl <external_ip_address>:<port_number>
233262
----
234-
* `<external_ip_address>:<port_number>`: Specifies the external IP address and port number to suit your application endpoint.
263+
+
264+
where `<external_ip_address>` is the `EXTERNAL-IP` value from the previous step, and `<port_number>` is the port number of your application endpoint.
235265

236-
. Optional: If you assigned the `LoadBalancer` service ingress IP address as the source IP address for egress traffic, verify this configuration by using tools such as `tcpdump` to analyze packets received at the external client.
266+
. Optional: If you assigned the `LoadBalancer` service ingress IP address as the source IP address for egress traffic, verify this configuration by using tools such as `tcpdump` to analyze packets received at the external client.

0 commit comments

Comments
 (0)