# Metal LB

## Install

```bash
# Set a manual IP if you have a no-dhcp network
nmcli connection modify "Wired connection 2" \
ipv4.method manual \
ipv4.gateway 10.4.0.1 \
ipv4.addresses 10.4.0.3/22

# Clear it if you have a dhcp network
nmcli connection modify "Wired connection 2" \
ipv4.addresses "" \
ipv4.gateway "" \
ipv4.method auto

# Bring up the interface
nmcli connection up "Wired connection 2"

# Create the metallb namespace
kubectl apply -f active/kubernetes_metallb/namespace.yaml

# Install metallb
helm repo add metallb https://metallb.github.io/metallb
helm repo update
helm upgrade --install metallb \
--namespace metallb-system \
metallb/metallb

# Check that the pods installed correctly
kubectl get pod -n metallb-system

# Install the address pool
# NOTE: Edit this to match your own allocated addresses!
kubectl apply -f active/kubernetes_metallb/addresspool.yaml

# Test that the service is working. This will spin up a web server on port 8001
kubectl apply -f active/kubernetes_metallb/metallb-test.yaml

# Delete the test
kubectl delete -f active/kubernetes_metallb/metallb-test.yaml
```
