When running Kubernetes on bare metal clusters, MetalLB provides load balancing functionality that cloud providers offer automatically. However, administrators frequently encounter issues where MetalLB fails to assign external IPs or the assigned IPs remain unreachable. This guide from PerLod Hosting explains why MetalLB external IP is not working and provides the best troubleshooting steps to resolve these issues.
MetalLB assigns external IP addresses to LoadBalancer services through a two-component system. The controller component allocates IP addresses from configured pools, while speaker components announce these IPs on the network using Layer 2 (ARP or NDP) or BGP protocols.
When you create a LoadBalancer service, the MetalLB controller watches for the new service and selects an available IP from an IPAddressPool resource.
The controller assigns this IP to the service's status field. After the assignment, speaker pods announce the IP on the network so external clients can reach it.
Both resources are required. Creating only the IPAddressPool without L2Advertisement is the most common configuration mistake that causes unreachable IPs.
In Layer 2 mode, MetalLB speakers answer ARP requests for service IPs. When a device asks Who has 192.168.1.240?, MetalLB replies with the node's MAC address, so traffic routes to that node, and kube-proxy sends it to the correct pods.
Discover MetalLB External IP Issues
MetalLB failures usually happen in three ways: services stay pending, the IP address exists but cannot be reached, or a core component crashes.
1. External IP Stuck in Pending State: When services show pending in the EXTERNAL-IP column, MetalLB has not assigned an IP address.
Check the service status with the command below:
Bash
kubectlgetsvc-A|grepLoadBalancer
In the output, you will see:
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)default nginx-service LoadBalancer 10.96.123.45 <pending> 80:30123/TCP
This happens because:
No Pool Created: You have not defined an IPAddressPool yet.
Out of IPs: Every IP in your pool is already in use.
Invalid IP Format: The IP range is written incorrectly.
Controller Down: The MetalLB controller is not running.
Wrong Namespace: The IP pool is restricted to a specific namespace that does not match your service.
You can check controller logs to identify the specific cause:
Now that you have learned to identify MetalLB external IP failures, you can proceed to the following steps to fix the issues.
Fix Missing MetalLB L2Advertisement Configuration
In this problem, the external IP is assigned but unreachable, which means L2Advertisement is missing.
Check if the L2Advertisement exists with the command below:
Bash
kubectlgetl2advertisement-nmetallb-system
If it returns No resources found, you must create the L2Advertisement:
YAML
1apiVersion: metallb.io/v1beta12kind: L2Advertisement3metadata:4name: default-l2-advertisement5namespace: metallb-system6spec:7ipAddressPools:8- production-pool # Match your IPAddressPool name
Finally, test connectivity with the following commands:
Bash
ping192.168.1.240curlhttp://192.168.1.240
Fix MetalLB IP Pool Configuration Errors
In this issue, services are stuck in a pending state due to pool configuration issues.
If it happens because of invalid IP format, you must use the correct format:
YAML
1addresses:2-192.168.1.240-192.168.1.250# Range format3-192.168.1.0/24# CIDR format
If it happens because of the wrong subnet, check the node IPs:
Bash
kubectlgetnodes-owide
If nodes are on 192.168.4.0/24, MetalLB IPs must be in the same subnet:
YAML
1apiVersion: metallb.io/v1beta12kind: IPAddressPool3metadata:4name: production-pool5namespace: metallb-system6spec:7addresses:8-192.168.4.240-192.168.4.250# Same subnet as nodes
If the problem happens because the IP pool is exhausted, count LoadBalancer services:
Bash
kubectlgetsvc-A|grepLoadBalancer|wc-l
If count equals your pool size, you must expand the range:
YAML
1apiVersion: metallb.io/v1beta12kind: IPAddressPool3metadata:4name: production-pool5namespace: metallb-system6spec:7addresses:8-192.168.1.240-192.168.1.2509-192.168.1.160-192.168.1.170# Additional range
If your load balancer is not working, the logs will tell you why. You can use these commands to detect internal errors, verify ARP announcements, and track service events to identify exactly where the connection is failing.
# From client machinearp-n|grep192.168.1.240ping192.168.1.240# From Kubernetes nodesudotcpdump-ieth0arphost192.168.1.240-n
Conclusion
MetalLB external IP failures on bare metal occur because of configuration errors, missing resources, or network incompatibilities. If your service stays pending, MetalLB cannot allocate an IP. Check that your IPAddressPool exists and uses valid ranges. If the IP is assigned but unreachable, MetalLB cannot announce it. Verify that the L2Advertisement resource exists, the IP matches your node subnet, and strictARP is enabled for IPVS mode.
For dedicated server environments running Kubernetes, MetalLB provides essential load-balancing capabilities that would otherwise require external hardware load balancers.
Always resolve issues by checking the controller and speaker logs and testing connectivity after every fix.
We hope you enjoy this MetalLB external IP error fixes guide. Subscribe to our X and Facebook channels to get the latest updates and articles.
Services stay pending when MetalLB cannot assign an IP. Verify that your IPAddressPool exists and has valid addresses, then check the controller logs for errors.
Yes, only for IPVS mode. If you use kube-proxy in IPVS mode, strictARP must be enabled. It is not required for iptables.
No, not in Layer 2 mode. The load balancer IPs must be in the same subnet as your Kubernetes nodes. To use a different subnet, you must configure BGP mode.
We use cookies to run PerLod and to understand how the site is used. You can accept everything, or open Manage to turn individual categories off. Cookie policy.