- Install docker-ce runtime per the basic instructions on docker.com.
- Disable the k3s default lb(klipper-lb).
- use host networking for the docker container.
- tell k3s server to pass
--ipcs-strict-arpto its kube-proxy code path.
k3d cluster create my-cluster --no-lb --network host --k3s-arg "--kube-proxy-arg=--ipvs-strict-arp"
kubectl apply -f https://raw.githubusercontent.com/mattsn0w/k3s-home/main/metallb/metallb-native_v13.7.yaml
You might need to apply this twice since its slow to load first time.
kubectl apply -f https://raw.githubusercontent.com/mattsn0w/k3s-home/main/metallb/l2advertise.yaml
Modify the address pool range based on the subnet info in WSL ip a s output
wget https://raw.githubusercontent.com/mattsn0w/k3s-home/main/metallb/ipaddresspool.yaml
kubectl apply -f ipaddresspool.yaml
alias k=kubectl
k create svc loadbalancer my-metal-lb --dry-run=client -o yaml --tcp=80:80 > svc-lb.yaml
k apply -f svc-lb.yaml # give it a look over before applying.
k create deployment lb-web-demo --image=nginxdemos/hello --replicas=2 --port=80 --dry-run=server -o yaml > deployment.yaml
# Edit the deployment to ensure that you have the selector.app set to match the load balancer service.
vim deployment.yaml
k apply -f deployment.yaml