MetalLB load-balancer for Kubernetes¶
Available since MKE 3.7.0
MetalLB is a load-balancer implementation for bare metal Kubernetes clusters, using standard routing protocols.
Prerequisites¶
An MKE cluster that is running Kubernetes 1.13.0 or later, which does not already have network load-balancing functionality.
A cluster network configuration that is compatible with MetalLB.
Available IPv4 addresses that MetalLB can allocate.
BGP operating mode requires one or more routers capable of communicating with BGP.
When using the L2 operating mode, traffic on port 7946 must be allowed between nodes, as required by memberlist. You can configure TCP, UDP, and other ports.
Verification that
kube-proxy
is running iniptables
mode.Verification of the absence of any cloud provider configuration
Install MetalLB¶
You use the MKE configuration file to install MetalLB:
Obtain the current MKE configuration file for the cluster.
Set the
enabled
parameter setting for thecluster_config.metallb_config.enabled
totrue
.Verify the successful deployment of MetalLB in the cluster.
Verify the creation of the
metallb-system
namespace:kubectl get ns metallb-system
Example output:
NAME STATUS AGE metallb-system Active 93s
Verify that all MetalLB components are running in the system:
Verify the Pods:
kubectl get pods -n metallb-system
Example output:
NAME READY STATUS RESTARTS AGE controller-669d7d89b5-58s2g 1/1 Running 0 119s speaker-cchsw 1/1 Running 0 119s speaker-ph96f 1/1 Running 0 119s
Verify the Daemonsets:
kubectl get daemonsets -n metallb-system
Example output:
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE speaker 2 2 2 2 2 kubernetes.io/os=linux 28m
Verify the Deployments:
kubectl get deployment -n metallb-system
Example output:
NAME READY UP-TO-DATE AVAILABLE AGE controller 1/1 1 1 29m
Verify the Services:
kubectl get services -n metallb-system
Example output:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE webhook-service ClusterIP 10.96.18.104 <none> 443/TCP 29m
Verify the creation of the Custom Resource Defintions:
kubectl get crd -n metallb-system
Example output:
NAME CREATED AT addresspools.metallb.io 2023-03-16T17:11:02Z bfdprofiles.metallb.io 2023-03-16T17:11:03Z bgpadvertisements.metallb.io 2023-03-16T17:11:03Z bgppeers.metallb.io 2023-03-16T17:11:03Z communities.metallb.io 2023-03-16T17:11:03Z ipaddresspools.metallb.io 2023-03-16T17:11:03Z l2advertisements.metallb.io 2023-03-16T17:11:03Z
Verify the creation of the specified IP pools:
kubectl get IPAddressPools -n metallb-system
Example output:
NAME AUTO ASSIGN AVOID BUGGY IPS ADDRESSES example1 true false ["192.168.10.0/24","192.168.1.0/24"] example2 true false ["52.205.10.1/24"]
Uninstall Metallb¶
To uninstall MetalLB you need only update the MKE configuration file.
Obtain the current MKE configuration file for the cluster.
Set
cluster_config.metallb_config.enabled
tofalse
.Upload the modified MKE configuration file and allow at least 5 minutes for MKE to propagate the configuration changes throughout the cluster.
Verify the successful uninstall of MetalLB in the cluster.
Verify that no MetalLB components are running in the system.
Verify the Pods:
kubectl get pods -n metallb-system
Example output:
No resources found in metallb-system namespace.
Verify the Daemonsets:
kubectl get daemonsets -n metallb-system
Example output:
No resources found in metallb-system namespace.
Verify the Deployments:
kubectl get deployment -n metallb-system
Example output:
No resources found in metallb-system namespace.
Verify the Services:
kubectl get services -n metallb-system
Example output:
No resources found in metallb-system namespace.
Verify the deletion of all IP address pools.
kubectl get IPAddressPools -n metallb-system
Example output:
No resources found in metallb-system namespace.