Skip to content

Commit a76e465

Browse files
Merge pull request #57137 from snarayan-redhat/OSDOCS-4630_l2advertisement
OSDOCS-4630: L2 advertisement using interfaces
2 parents 110a6c8 + ce0eac9 commit a76e465

File tree

3 files changed

+82
-1
lines changed

3 files changed

+82
-1
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * networking/metallb/about-advertising-ipaddresspool.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="nw-metallb-configure-with-L2-advertisement-interface_{context}"]
7+
= Configuring MetalLB with an L2 advertisement for selected interfaces
8+
9+
By default, the IP addresses from IP address pool that has been assigned to the service, is advertised from all the network interfaces. The `interfaces` field in the `L2Advertisement` custom resource definition is used to restrict those network interfaces that advertise the IP address pool.
10+
11+
This example shows how to configure MetalLB so that the IP address pool is advertised only from the network interfaces listed in the `interfaces` field of all nodes.
12+
13+
.Prerequisites
14+
15+
* You have installed the OpenShift CLI (`oc`).
16+
17+
* You are logged in as a user with `cluster-admin` privileges.
18+
19+
.Procedure
20+
21+
. Create an IP address pool.
22+
23+
.. Create a file, such as `ipaddresspool.yaml`, and enter the configuration details like the following example:
24+
+
25+
[source,yaml]
26+
----
27+
apiVersion: metallb.io/v1beta1
28+
kind: IPAddressPool
29+
metadata:
30+
namespace: metallb-system
31+
name: doc-example-l2
32+
spec:
33+
addresses:
34+
- 4.4.4.0/24
35+
autoAssign: false
36+
----
37+
38+
.. Apply the configuration for the IP address pool like the following example:
39+
+
40+
[source,terminal]
41+
----
42+
$ oc apply -f ipaddresspool.yaml
43+
----
44+
45+
. Create a L2 advertisement advertising the IP with `interfaces` selector.
46+
47+
.. Create a YAML file, such as `l2advertisement.yaml`, and enter the configuration details like the following example:
48+
+
49+
[source,yaml]
50+
----
51+
apiVersion: metallb.io/v1beta1
52+
kind: L2Advertisement
53+
metadata:
54+
name: l2advertisement
55+
namespace: metallb-system
56+
spec:
57+
ipAddressPools:
58+
- doc-example-l2
59+
interfaces:
60+
- interfaceA
61+
- interfaceB
62+
----
63+
64+
.. Apply the configuration for the advertisement like the following example:
65+
+
66+
[source,terminal]
67+
----
68+
$ oc apply -f l2advertisement.yaml
69+
----
70+
71+
[IMPORTANT]
72+
====
73+
The interface selector does not affect how MetalLB chooses the node to announce a given IP by using L2. The chosen node does not announce the service if the node does not have the selected interface.
74+
====

modules/nw-metallb-l2padvertisement-cr.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,8 @@ Specify the same namespace that the MetalLB Operator uses.
4040
:FeatureName: Limiting the nodes to announce as next hops
4141
include::snippets/technology-preview.adoc[leveloffset=+1]
4242

43+
|`spec.interfaces`
44+
|`string`
45+
|Optional: The list of `interfaces` that are used to announce the load balancer IP.
46+
4347
|===

networking/metallb/about-advertising-ipaddresspool.adoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ include::modules/nw-metallb-configure-bgp-advertisement-advanced.adoc[leveloffse
2828
// Advertise MetalLB with a BGP advertisement
2929
include::modules/nw-metallb-advertise-address-pool-with-bgp-advanced.adoc[leveloffset=+2]
3030

31-
// Advertise IP address pools from a subset of nodes
31+
// Advertise IP address pools from a subset of nodes
3232
include::modules/nw-metallb-advertise-ip-pools-from-node-subset.adoc[leveloffset=+1]
3333

3434
// L2 advertisement custom resource
@@ -40,6 +40,9 @@ include::modules/nw-metallb-configure-l2-advertisement.adoc[leveloffset=+1]
4040
// Configure MetalLB with a L2 advertisement using label
4141
include::modules/nw-metallb-configure-l2-advertisement-label.adoc[leveloffset=+1]
4242

43+
// Configure MetalLB with a L2 advertisement using interface
44+
include::modules/nw-metallb-configure-l2-advertisement-interface.adoc[leveloffset=+1]
45+
4346
[role="_additional-resources"]
4447
[id="additional-resources_about-advertiseipaddress"]
4548
== Additional resources

0 commit comments

Comments
 (0)