Creating External IP Address Pool
An external IP address pool is a collection of IPs that MetalLB utilizes to obtain external access IPs for LoadBalancer type internal routes.
TOC
Prerequisites
If you need to use a BGP type external IP address pool, please contact the administrator to enable the relevant features.
Constraints and Limitations
The IP resources for the external address must meet the following conditions:
-
The external address pool must be layer 2 (L2) interconnected with available nodes.
-
The IPs must be usable by the platform and cannot include IPs already in use by the physical network, such as gateway IPs.
-
There must be no overlap with the networks used by the cluster, including Cluster CIDR, Service CIDR, subnets, etc.
-
In a dual-stack environment, ensure that both IPv4 and IPv6 addresses exist simultaneously in the same external address pool, and their counts are both greater than 0. Otherwise, dual-stack LoadBalancer type internal routes will not be able to obtain external access addresses.
-
In an IPv6 environment, nodes' DNS must support IPv6; otherwise, the MetalLB plugin cannot be successfully deployed.
Deploying the MetalLB Plugin
Using the external address pool relies on the MetalLB plugin.
-
Go to Administrator.
-
In the left navigation bar, click Marketplace > Cluster Plugin.
-
Search MetalLB, click on MetalLB to the right of ⋮ > Deploy.
-
Wait until the deployment status shows Deployment Successful to complete the deployment.
Example IPAddressPool custom resource (CR)
BGP mode:
- Ip pool reference.
Q: What is L2Advertisement?
A:
L2Advertisementis a Custom Resource (CRD) provided by the MetalLB to control which IP address pool addresses should be broadcast via ARP (IPv4) or NDP (IPv6) in Layer 2 mode.
Q: What is the purpose of L2Advertisement?
A:
-
Specifying which IP addresses in the IPAddressPool to L2 broadcast to (ARP/NDP advertisements);
-
Control broadcast behaviour to prevent IP conflicts or cross-segment broadcasts;
-
Restricting the broadcast range in multi-NIC, multi-network environments.
In short, it tells MetalLB: which IPs can broadcast and to whom (e.g., which nodes).
Without defining a L2Advertisement in Layer2 mode, MetalLB will not advertise any addresses.
Q: What is BGPAdvertisement in MetalLB?
A:
BGPAdvertisement is a Kubernetes Custom Resource Definition (CRD) used in MetalLB, a load-balancer implementation for bare-metal Kubernetes clusters. It controls how IP address ranges (defined in IPAddressPool) are advertised to external networks via BGP (Border Gateway Protocol).
Q: Why is BGPAdvertisement Important?
A:
In MetalLB's BGP mode, the controller peers with external routers using BGP and advertises the IPs assigned to Kubernetes Service objects. The BGPAdvertisement resource allows you to:
-
Control which address pools are advertised
-
Customize route advertisement settings like:
-
Route aggregation
-
BGP communities
-
Local preference (BGP priority)
-
Without defining a BGPAdvertisement, MetalLB will not advertise any addresses, even if you have configured BGP peers.
Creating an External IP Address Pool by using the web console
-
Go to Administrator.
-
In the left navigation bar, click Network Management > External IP Address Pool.
-
Click Create External IP Address Pool.
-
Refer to the following instructions to configure certain parameters.
-
Click Create.
Creating an External IP Address Pool by using the CLI
View Alarm Policy
-
Go to Administrator.
-
In the left navigation bar, click Network Management > External IP Address Pool.
-
Click View Alarm Policy in the upper right corner of the page to view the general alarm policy for MetalLB.