MetalLB Application Load Balancing

This document describes the concept of creating services of type LoadBalancer on your on premises Kubernetes clusters using PMK. Understanding of Kubernetes concepts of Service type LoadBalancer and External LoadBalancers is recommended.

MetalLB Introduction

Kubernetes offers a concept of running services of type LoadBalancer with the ability to map them to an external load balancer specific to the environment on which you are running the cluster on. However, the network loadbalancers that Kubernetes ships with out of box today are limited to those that integrate with public clouds only such as AWS, GCP, Azure. There isn’t any default implementation available today for a network loadbalancer for bare metal clusters.

MetalLB addresses this issue by offering an open source network load balancer implementation for bare metal Kubernetes clusters. MetalLB integrates with your standard networking equipment that is usually available in a typical data center. This enables you to create externally facing services on your bare metal Kubernetes cluster.

For more information on MetalLB, refer to the MetalLB documentation.

PMK ships with and supports configuration of MetalLB for your BareOS clusters.

In order to run MetalLB on a cluster, the cluster must be enabled with ‘privileged mode’ for running containers.

Creating a PMK Cluster with MetalLB Enabled

MetalLB uses standard address discovery and routing protocols to advertise the external IP of a service on rest of your network. MetalLB can be configured to operate in Layer-2 Mode or BGP Mode.

PMK configures MetalLB to operate in Layer-2 Mode because of its universal applicability - ie it can work on any ethernet network, with no special hardware required.

Creating a PMK Cluster with MetalLB Enabled

During cluster creation, PMK provides the option to enable MetalLB for the cluster in the Cluster Add-ons sections.

Refer here for how to enable and configure MetalLB Application Load Balancer Addon for your PMK cluster.

Creating Services of type LoadBalancer

To expose a service externally on a BareOS cluster that is configured to use MetalLB, simply create the service with spec.type set to LoadBalancer. MetalLB will do the rest.

For more information about the features MetalLB exposes that services can utilize, refer to Using MetalLB

Troubleshooting Issues with MetalLB

MetalLB attaches informational events to the services that it’s controlling. If your LoadBalancer is misbehaving, run kubectl describe service <service name> and check the Kubernetes event log.

Requesting Specific IPs for a Service

MetalLB respects the spec.loadBalancerIP parameter, so if you want your service to be set up with a specific address, you can request it by setting that parameter. If MetalLB does not own the requested address, or if the address is already in use by another service, assignment will fail and MetalLB will log a warning event visible in kubectl describe service <service name>.

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
  Last updated by Anmol Sachan