Kubernetes controller that implements a custom LoadBalancer class to aggregate multiple LoadBalancer services into a single virtual LoadBalancer by collecting their external IPs.
virtual-lb groups existing LoadBalancer services under a common virtual LoadBalancer service using the custom athmer.cloud/virtual-lb LoadBalancerClass. The virtual LoadBalancer's status reflects all external IPs from member services, enabling tools like external-dns to register multiple addresses for a single DNS name.
In IBM KS, each NLB (Network Load Balancer) resides in a single zone only. To achieve HA across zones, you must create separate LoadBalancer services for each zone's NLB. However, external-dns will pick up each service independently, creating separate DNS records. virtual-lb solves this by aggregating multiple zone NLBs into a single virtual LoadBalancer that presents all zone IPs under one address.
virtual-lb is available as a Helm chart in the OCI registry:
helm install virtual-lb oci://ghcr.io/elmarx/charts/virtual-lb-
Label member services:
- Add labels to each LoadBalancer service you want to aggregate:
athmer.cloud/virtual-lb.member: "true"athmer.cloud/virtual-lb.name: <cluster-name>
- Add labels to each LoadBalancer service you want to aggregate:
-
Create virtual LoadBalancer service:
- Create a service with
loadBalancerClass: athmer.cloud/virtual-lb - Add annotation
athmer.cloud/virtual-lb.name: <cluster-name> - Controller will populate its status with IPs from all matching member services
- Create a service with
Using kind, a simple demo is available. It can be set up by running just build demo:
- deploy the virtual-lb controller to the cluster
- create two load balancers (a, b) to be aggregated — assign them dummy IP addresses — these LBs will not route any traffic
- create a virtual-lb service that is reconciled by the controller and assigned the IP addresses
You can play around and test the demo. To re-run the demo script, delete the demo namespace.
