Closed Zorlin closed 1 year ago
IP range will be 10.24.5.1 through 10.24.5.254
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: prod-pool-a
namespace: metallb-system
spec:
addresses:
- 10.24.5.0/24
Installation:
helm install metallb metallb/metallb -n metallb-system
Apply the pool:
$ kubectl apply -f pool.yaml
ipaddresspool.metallb.io/prod-pool-a created
Apply the L2 config:
$ cat l2.yaml
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: prod-pool-a-layer2
namespace: metallb-system
spec:
ipAddressPools:
- prod-pool-a
$ kubectl apply -f l2.yaml
l2advertisement.metallb.io/prod-pool-a-layer2 created
Testing:
$ cat test.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx-pod
spec:
containers:
- name: nginx-container
image: nginx
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
type: LoadBalancer
selector:
app: nginx-pod
ports:
- protocol: TCP
port: 80
targetPort: 80
$ kubectl apply -f test.yaml
pod/nginx-pod created
service/nginx-service created
We need to install and setup MetalLB to allow us to expose Kubernetes resources such as PostgreSQL to public routing.
Steps