Top Tags

MetalLB: Load Balancer for Kubernetes in Docker Desktop

MetalLB is a load-balancer implementation for Kubernetes that allows you to expose services externally. It provides a way to assign external IP addresses to services in a Kubernetes cluster, enabling them to be accessed from outside the cluster.

Install MetalLB

bash
1kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.9/config/manifests/metallb-native.yaml

Check Docker Destop IPs

bash
1docker network inspect -f '{{.IPAM.Config}}' kind

Adjust config for metalLB

yaml
1# metallb-config.yaml
2apiVersion: metallb.io/v1beta1
3kind: IPAddressPool
4metadata:
5 name: default-pool
6 namespace: metallb-system
7spec:
8 addresses:
9 - 172.18.255.200-172.18.255.250 # adjust based on your kind network range
10---
11apiVersion: metallb.io/v1beta1
12kind: L2Advertisement
13metadata:
14 name: default
15 namespace: metallb-system

Apply the config

bash
1kubectl apply -f metallb-config.yaml

Verify MetalLB is working

bash
1kubectl get pods -n metallb-system
2
3kubectl get svc -n ingress-nginx