Description: A network load-balancer implementation for Kubernetes using standard routing protocols
View metallb/metallb on GitHub ↗
Detailed Description
Metallb is a network load-balancer implementation for Kubernetes clusters. It’s designed to provide a stable, scalable, and easy-to-use load balancing solution, particularly for bare metal deployments where traditional cloud provider load balancers aren’t available. Essentially, it allows Kubernetes Services of type `LoadBalancer` to be exposed with an external IP address, even without relying on external infrastructure like AWS ELB, Google Cloud Load Balancer, or Azure Load Balancer. It achieves this by announcing these IP addresses via standard routing protocols, making the services accessible from outside the cluster.
The core concept revolves around "Speakers" and "Controllers." The *Controller* component watches for Kubernetes Services of type `LoadBalancer` and manages the allocation of external IP addresses from configured pools. It determines which nodes should be responsible for advertising those IPs. The *Speakers* are agents that run on each node in the Kubernetes cluster. They listen to the Controller and, based on the Controller’s decisions, advertise the assigned IP addresses using either BGP (Border Gateway Protocol) or ARP/NDP (Address Resolution Protocol/Neighbor Discovery Protocol). This is where the actual load balancing happens – the Speakers make the external IPs reachable through the nodes they’re running on.
Metallb supports two primary modes of operation: *Layer2* and *BGP*. Layer2 mode uses ARP and NDP to advertise the external IP addresses. This is simpler to set up and works well in environments where you control the entire network and can rely on Layer2 forwarding. However, it’s limited to a single subnet and doesn’t scale well across multiple subnets or networks. BGP mode, on the other hand, uses the BGP routing protocol to advertise the IPs to your network’s routers. This is more complex to configure, requiring a BGP peer relationship with your network infrastructure, but it offers greater scalability, redundancy, and flexibility, allowing for multi-subnet and even multi-cloud deployments.
Configuration is done through Kubernetes Custom Resource Definitions (CRDs). Specifically, `MetalLB` objects define the IP address pools from which external IPs are allocated. These pools can be static ranges or dynamically allocated. `Service` annotations are used to specify that a particular service should be load-balanced by Metallb. The repository provides extensive documentation and examples to guide users through the configuration process, including detailed explanations of the various options and settings available. It also includes tools for troubleshooting and monitoring.
Beyond the core functionality, Metallb offers features like session affinity (sticky sessions), health checks (though relying on Kubernetes probes is generally preferred), and the ability to configure multiple IP address pools. The project is actively maintained and has a growing community, making it a reliable and well-supported solution for Kubernetes load balancing. It’s particularly valuable for edge computing, on-premise Kubernetes deployments, and situations where cloud provider load balancers are unavailable or undesirable due to cost or control concerns. The GitHub repository itself contains the source code, documentation, issue tracker, and contribution guidelines for the project.
Fetching additional details & charts...