You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/nw-metallb-configure-return-traffic-proc.adoc
+39-9Lines changed: 39 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ The example in the procedure associates a VRF routing table with MetalLB and an
13
13
14
14
[IMPORTANT]
15
15
====
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).
17
17
18
18
* 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.
19
19
====
@@ -24,9 +24,20 @@ The example in the procedure associates a VRF routing table with MetalLB and an
24
24
* Log in as a user with `cluster-admin` privileges.
25
25
* Install the Kubernetes NMState Operator.
26
26
* Install the MetalLB Operator.
27
+
* Create a namespace for your application workload. The examples in this procedure use a namespace called `test`.
27
28
28
29
.Procedure
29
30
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
+
30
41
. Create a `NodeNetworkConfigurationPolicy` CR to define the VRF instance:
31
42
+
32
43
.. Create a file, such as `node-network-vrf.yaml`, with content like the following example:
@@ -71,7 +82,7 @@ spec:
71
82
- ip-to: 172.30.0.0/16
72
83
priority: 998
73
84
route-table: 254
74
-
- ip-to: 10.132.0.0/14
85
+
- ip-to: 10.128.0.0/14
75
86
priority: 998
76
87
route-table: 254
77
88
- ip-to: 169.254.0.0/17
@@ -88,7 +99,7 @@ where:
88
99
`interfaces.type`:: Specifies the type of interface. This example creates a VRF instance.
89
100
`vrf.port`:: Specifies the node interface that the VRF attaches to.
90
101
`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.
92
103
`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.
93
104
`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`.
94
105
`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:
99
110
----
100
111
$ oc apply -f node-network-vrf.yaml
101
112
----
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.
102
122
103
123
. Create a `BGPPeer` custom resource (CR):
104
124
+
@@ -179,7 +199,7 @@ spec:
179
199
where:
180
200
+
181
201
`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.
183
203
+
184
204
.. Apply the configuration for the BGP advertisement by running the following command:
185
205
+
@@ -210,11 +230,11 @@ spec:
210
230
+
211
231
where:
212
232
+
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.
215
235
`spec.sourceIPBy`:: Specifies the `LoadBalancer` service ingress IP address as the source IP address for egress traffic.
216
236
`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`.
218
238
+
219
239
.. Apply the configuration for the egress service by running the following command:
. 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
+
228
257
. Verify that you can access the application endpoint of the pods running behind the MetalLB service by running the following command:
229
258
+
230
259
[source,terminal]
231
260
----
232
261
$ curl <external_ip_address>:<port_number>
233
262
----
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.
235
265
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