Metallb
Here are the steps that I just went through to set up Metallb:
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.12/config/manifests/metallb-native.yaml
kubectl apply -f internal.yml
internal.yml
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: internal
namespace: metallb-system
spec:
addresses:
- 192.168.5.60-192.168.5.70
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: internal-advertisment
namespace: metallb-system
spec:
ipAddressPools:
- internal
So there are a couple of things happening here:
- The first part of this file defines a IP pool called
internal
, with the IP addresses192.168.5.60-192.168.5.70
- The second part advertises this address range as Layer 2 (?), but it essentially exposes this address pool
And that seems to be working, I’ll see in a second when I try to deploy a container.
For testing, use the following lb-deployment.yml
:
apiVersion: v1
kind: Service
metadata:
name: nginx
annotations:
spec:
ports:
- port: 80
targetPort: 80
selector:
app: nginx
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80