Hands-on Lab·Certified Kubernetes Administrator
LoadBalancer Services on Bare Metal with MetalLB
A LoadBalancer Service off-cloud sits at Pending forever, because nothing is listening for it. MetalLB is the thing that listens: it hands out addresses from a pool and answers ARP for them from one node.
Services and Networking Guide 63 of 103 Intermediate
- Kubernetes1.36.4
- Cluster4 nodes
- Runtimecontainerd 2.2.6
- CNICalico v3.32.1
- TimeAbout 40 min
L2 mode, which needs only a free range on the node subnet. BGP mode needs a router that will peer, and behaves quite differently.
- MetalLBv0.15.2
- ModeL2Advertisement
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| CKA1001 | 192.168.0.175 | Ubuntu 26.04 LTS | Control Plane Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE01 | 192.168.0.176 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE02 | 192.168.0.177 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE03 | 192.168.0.178 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
This guide includes
Use this when a LoadBalancer Service sits at Pending forever off-cloud. This matters because nothing in Kubernetes implements that type - and installing MetalLB is not sufficient on its own, which is the part that catches people out.
- creating a LoadBalancer Service with no cloud provider and watching it stay Pending
- installing MetalLB as a controller plus a speaker on every node, and finding the Service still Pending - which is exactly the point
- adding an address pool and an L2 advertisement, and watching the address finally appear
- confirming it answers, and working out which node is answering for it
- seeing four allocation behaviours - sequential, requested, refused and exhausted
Before you start
- The Services guide, particularly the ClusterIP, NodePort and LoadBalancer types.
- A free range of addresses on the node subnet, outside any DHCP scope.
- Layer 2 reachability between the nodes, which L2 mode requires.
-
The Pending that never resolves
-
Install MetalLB: a controller and a speaker on every node
-
Installed and still Pending, which is the point
-
A pool and an advertisement, and the address appears
-
It answers, and one node is answering for it
-
Allocation: sequential, requested, refused, exhausted