You stand up a three-node k3s cluster on three bare-metal servers in your colo, deploy your first workload, expose it with type: LoadBalancer, and the Service sits in <pending> forever. There is no AWS ELB controller. There is no DigitalOcean LB integration. There is just a Kubernetes API politely waiting for some external thing to assign an IP from somewhere — and on bare metal, that “external thing” is your problem. MetalLB is the answer. In L2 mode it works on any single broadcast domain without router configuration: one of the speakers wins an election, replies to ARP for the service IP, and traffic shows up. The whole installation is roughly 200 lines of YAML and one IPAddressPool. The trap is getting the IP-pool layout right — pick the wrong subnet and you fight DHCP for the rest of the year.
What’s happening
A k3s cluster on bare metal has no cloud load balancer behind it. When a Service of type: LoadBalancer is created, Kubernetes asks the cluster’s “service controller” to assign an external IP. On a managed cloud, that controller talks to the cloud’s LB API. On bare metal, nothing is listening — the Service stays pending and the workload is unreachable from outside the cluster. MetalLB plugs that hole. It runs two components: a controller that watches Services and assigns IPs from configured pools, and a speaker DaemonSet that runs on every node and announces those IPs to the network. In L2 mode the speaker uses gratuitous ARP (IPv4) or NDP (IPv6) to claim the IP — one node “owns” the address at any moment, the other speakers stay quiet, and on failover a new speaker takes over via ARP within a few seconds. There is no real load balancing in L2 mode; it is failover plus client-side spray (clients hit one node, kube-proxy forwards from there). For real ECMP load balancing you switch to BGP mode, which is a separate article. L2 mode is the right pick when your cluster lives on a single L2 segment, your router won’t peer BGP with you, and you want the simplest possible install. The hard constraints: the address pool must be on the same subnet as the node IPs, those addresses must NOT be in any DHCP range, and you must not enable both L2 and BGP modes for the same pool.
How to verify
After install, a Service of type: LoadBalancer should get an external IP from the configured pool within seconds:
kubectl create deploy whoami --image=traefik/whoami --port=80
kubectl expose deploy whoami --type=LoadBalancer --port=80 --target-port=80
kubectl get svc whoami -w
# NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
# whoami LoadBalancer 10.43.123.45 10.10.0.240 80:31234/TCP 3s
Confirm the IP is reachable from a workstation on the same L2:
curl http://10.10.0.240/
# Hostname: whoami-7d8b6c4f5-abcde
# IP: 127.0.0.1
# ...
Check which speaker is announcing the IP:
kubectl -n metallb-system logs -l component=speaker --tail=200 | grep -i announcing
# {"caller":"announcer.go","event":"serviceAnnounced","ip":"10.10.0.240","msg":"service announced","node":"k3s-node1"}
From outside, run arping against the LB IP and confirm the MAC matches the announcing node:
arping -c 3 10.10.0.240
# 60 bytes from aa:bb:cc:dd:ee:01 (10.10.0.240): index=0 time=0.412 msec
That MAC should be one of your k3s nodes’ interface MACs, not a router or DHCP server.
The fix
The installer below stands up MetalLB v0.14 in L2 mode on a 3-node k3s cluster running on 10.10.0.11/12/13 with an LB pool of 10.10.0.240-10.10.0.250. Run from any workstation that has kubectl pointed at the cluster’s kubeconfig. The script blocks on each readiness gate so if a step fails you see exactly which one.
#!/usr/bin/env bash
set -euo pipefail
### MetalLB v0.14 L2-mode installer for a bare-metal k3s cluster
### Run from a workstation with kubectl configured against the cluster.
### Assumes the cluster lives on a single L2 segment (e.g. 10.10.0.0/24).
if ! command -v kubectl >/dev/null 2>&1; then
echo "kubectl is required."
exit 1
fi
# === EDIT FOR YOUR ENVIRONMENT ===
METALLB_VERSION="v0.14.8"
POOL_NAME="prod-lb-pool"
POOL_RANGE="10.10.0.240-10.10.0.250" # MUST be outside the DHCP range
NODE_SUBNET="10.10.0.0/24"
L2_ADVERTISEMENT_NAME="prod-l2-adv"
# =================================
echo
echo "========================================"
echo "MetalLB ${METALLB_VERSION} L2 install"
echo "Pool: ${POOL_NAME} (${POOL_RANGE})"
echo "========================================"
echo
echo "==> Verifying cluster reachable"
kubectl cluster-info >/dev/null
echo "==> Confirming k3s did not enable its own servicelb"
SERVICELB=$(kubectl -n kube-system get svc -l svccontroller.k3s.cattle.io/svcname 2>/dev/null | wc -l)
if [[ "${SERVICELB}" -gt 0 ]]; then
echo "k3s servicelb (klipper-lb) appears active. On every server node, edit"
echo "/etc/systemd/system/k3s.service and add --disable=servicelb to ExecStart,"
echo "then 'systemctl daemon-reload && systemctl restart k3s' before re-running."
exit 1
fi
echo "==> Enabling strictARP on kube-proxy (required for L2 mode)"
# k3s embeds its own kube-proxy. If you use a separate kube-proxy DaemonSet,
# patch the configmap; otherwise k3s honours --kube-proxy-arg=proxy-mode=ipvs
# and strictARP via a flag file at /etc/rancher/k3s/config.yaml on each node.
# For pure-iptables k3s (default), L2 mode works without this — but we still
# apply the patch to a stand-alone kube-proxy if found.
if kubectl -n kube-system get cm kube-proxy >/dev/null 2>&1; then
kubectl -n kube-system get cm kube-proxy -o yaml | \
sed 's/strictARP: false/strictARP: true/' | \
kubectl apply -f -
kubectl -n kube-system rollout restart ds kube-proxy || true
fi
echo "==> Applying MetalLB manifests"
kubectl apply -f \
"https://raw.githubusercontent.com/metallb/metallb/${METALLB_VERSION}/config/manifests/metallb-native.yaml"
echo "==> Waiting for the controller deployment"
kubectl -n metallb-system rollout status deploy/controller --timeout=180s
echo "==> Waiting for the speaker daemonset"
kubectl -n metallb-system rollout status ds/speaker --timeout=180s
echo "==> Waiting for the CRDs to be Established"
for crd in ipaddresspools.metallb.io l2advertisements.metallb.io \
bgppeers.metallb.io bgpadvertisements.metallb.io \
communities.metallb.io bfdprofiles.metallb.io; do
kubectl wait --for=condition=Established --timeout=60s "crd/${crd}"
done
echo "==> Writing IPAddressPool + L2Advertisement"
cat > /tmp/metallb-pool.yaml <<EOF
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: ${POOL_NAME}
namespace: metallb-system
spec:
addresses:
- ${POOL_RANGE}
autoAssign: true
avoidBuggyIPs: true
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: ${L2_ADVERTISEMENT_NAME}
namespace: metallb-system
spec:
ipAddressPools:
- ${POOL_NAME}
EOF
kubectl apply -f /tmp/metallb-pool.yaml
echo "==> Quick smoke test (whoami service)"
kubectl create deploy metallb-smoke --image=traefik/whoami --port=80 \
--dry-run=client -o yaml | kubectl apply -f -
kubectl expose deploy metallb-smoke --type=LoadBalancer --port=80 --target-port=80 \
--dry-run=client -o yaml | kubectl apply -f -
echo "==> Waiting for external IP assignment (up to 60s)"
for i in {1..30}; do
IP=$(kubectl get svc metallb-smoke -o jsonpath='{.status.loadBalancer.ingress[0].ip}' 2>/dev/null || true)
if [[ -n "${IP}" ]]; then break; fi
sleep 2
done
if [[ -z "${IP:-}" ]]; then
echo "Service never got an external IP. Inspect:"
echo " kubectl describe svc metallb-smoke"
echo " kubectl -n metallb-system logs deploy/controller --tail=200"
exit 1
fi
echo
echo "========================================"
echo "DONE"
echo "========================================"
echo
echo "Speaker pods:"
kubectl -n metallb-system get pods -l component=speaker -o wide
echo
echo "Pool + advertisements:"
kubectl -n metallb-system get ipaddresspool,l2advertisement
echo
echo "Smoke service IP: ${IP}"
echo "Test from outside the cluster:"
echo " curl http://${IP}/"
echo
echo "When you are done with the smoke test:"
echo " kubectl delete deploy/metallb-smoke svc/metallb-smoke"
Make it executable and run from the workstation:
chmod 700 ./install-metallb-l2.sh
./install-metallb-l2.sh
A few operational notes you’ll want before you put real workloads behind it. The address pool MUST be carved out of your router’s DHCP exclusions; if your DHCP server hands 10.10.0.245 to a printer at 02:00 you will spend the rest of the day finding it. Set avoidBuggyIPs: true so MetalLB skips the .0 and .255 addresses inside the pool — some commodity switches drop traffic to those. Pin a specific IP per Service with spec.loadBalancerIP only if you need stability across recreates; otherwise let the pool assign and use external DNS to point at the IP. L2 failover happens via gratuitous ARP from the new owner, so failover time is bounded by your switch’s ARP cache and the speaker’s election interval — typically 3-10 seconds. If you need sub-second failover, you are in BGP territory, not L2. Finally, when you upgrade MetalLB across a minor version, read the release notes for CRD migrations; v0.14 dropped the legacy ConfigMap-based config, and an upgrade from v0.12 without re-applying the new CRDs will leave the speaker quiet.
Running Kubernetes on bare metal without a vendor doing the operations work has a learning curve. Our Cloud Compute team builds and runs k3s/k8s clusters under Managed Cloud Ops, with MetalLB, ingress, and load-balancer redundancy designed for your facility — start a scoping conversation if you’d like us to spec the network layer alongside it.