Skip to content

About

Virtual Kubernetes Loadbalancer class to combine multiple LoadBalancers

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

virtual-lb — Kubernetes virtual loadbalancer

virtual-lb logo

Kubernetes controller that implements a custom LoadBalancer class to aggregate multiple LoadBalancer services into a single virtual LoadBalancer by collecting their external IPs.

Overview

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.

Motivation: IBM Kubernetes Service

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.

Installation

virtual-lb is available as a Helm chart in the OCI registry:

helm install virtual-lb oci://ghcr.io/elmarx/charts/virtual-lb

Usage

  1. 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>
  2. 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

Demo

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.

About

Virtual Kubernetes Loadbalancer class to combine multiple LoadBalancers

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages