Skip to main content
In this lesson we demonstrate how to use Cilium’s LoadBalancer IPAM to assign EXTERNAL-IP addresses to Kubernetes Services of type LoadBalancer in an on-premises cluster (where cloud-managed load balancers are not available).
A presentation slide showing the word "Demo" on the left and a teal curved panel on the right labeled "LoadBalancer IPAM." The slide also has a small "© Copyright KodeKloud" notice in the corner.

Scenario

  • Cluster runs on-premises (not on AWS/EKS/AKS).
  • No external load-balancer controller (e.g., MetalLB) is installed.
  • We have two sample deployments and corresponding Services; one Service is LoadBalancer type and will initially show EXTERNAL-IP as <pending>.

Verify current Services

Check Services before deploying the sample apps:

Apply the sample Deployment and Services

Apply the manifest that creates two applications (myapp and myapp2) and their Services:
List Services again. Notice myapp-service is LoadBalancer type but its EXTERNAL-IP remains <pending> because no external IP provider exists in this on-prem cluster:

Provide external IPs with CiliumLoadBalancerIPPool

Instead of installing a separate external load balancer solution (for example, MetalLB), Cilium can allocate external IP addresses for LoadBalancer Services using a CiliumLoadBalancerIPPool resource. Create a file named lb-ipam.yaml with the IP block you want Cilium to manage. Example:
  • The blocks range specifies the pool of external IPs that Cilium can allocate.
  • Optionally use serviceSelector to limit assignments to Services with specific labels.
Apply the pool:
Now re-check Services:
The myapp-service now has EXTERNAL-IP assigned (172.19.255.1), taken from the configured pool. Subsequent LoadBalancer Services will receive .2, .3, etc., up to the stop address.
Cilium will allocate the EXTERNAL-IP from the pool, but you must ensure the cluster network and upstream routers/switches can route or reach those addresses. Typical methods include L2 advertisement (ARP/NDP) or BGP announcements so external clients can reach the assigned IPs.
If the assigned IPs are not reachable from your network, traffic to the external IP will fail—even though Kubernetes and Cilium show the IP as assigned. Configure ARP/NDP or BGP on your network infrastructure or use an appropriate routing/advertisement mechanism.

Quick reference

That’s the LoadBalancer IPAM workflow with Cilium: create a pool, apply it, and Cilium allocates external IPs for LoadBalancer Services (optionally scoped by label selectors).

Watch Video