1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/nw-metallb-configure-l2-advertisement-interface.adoc

76 lines
2.2 KiB
Plaintext

// Module included in the following assemblies:
//
// * networking/metallb/about-advertising-ipaddresspool.adoc
:_mod-docs-content-type: PROCEDURE
[id="nw-metallb-configure-with-L2-advertisement-interface_{context}"]
= Configuring MetalLB with an L2 advertisement for selected interfaces
[role="_abstract"]
To restrict which network interfaces advertise assigned service IP addresses, configure the interfaces parameter in the MetalLB `L2Advertisement` custom resource (CR). Defining specific interfaces ensures that cluster services are reachable only through designated network paths for improved traffic management and isolation.
The example in the procedure shows how to configure MetalLB so that the IP address pool is advertised only from the network interfaces listed in the `interfaces` parameter of all nodes.
.Prerequisites
* You have installed the {oc-first}.
* You are logged in as a user with `cluster-admin` privileges.
.Procedure
. Create an IP address pool.
+
.. Create a file, such as `ipaddresspool.yaml`, and enter the configuration details as shown in the following example:
+
[source,yaml]
----
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
namespace: metallb-system
name: doc-example-l2
spec:
addresses:
- 4.4.4.0/24
autoAssign: false
# ...
----
+
.. Apply the configuration for the IP address pool as shown in the following example:
+
[source,terminal]
----
$ oc apply -f ipaddresspool.yaml
----
. Create an L2 advertisement with the `interfaces` selector to advertise the IP address.
+
.. Create a YAML file, such as `l2advertisement.yaml`, and enter the configuration details as shown the following example:
+
[source,yaml]
----
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: l2advertisement
namespace: metallb-system
spec:
ipAddressPools:
- doc-example-l2
interfaces:
- interfaceA
- interfaceB
# ...
----
+
.. Apply the configuration for the advertisement as shown in the following example:
+
[source,terminal]
----
$ oc apply -f l2advertisement.yaml
----
+
[IMPORTANT]
====
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.
====