Metallb setup
We will use metallb to expose our services to the outside world.
Install metallb
sh
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.9/config/manifests/metallb-native.yaml
1
Configure metallb
yml
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: default-pool
namespace: metallb-system
spec:
addresses:
- 192.168.1.200-192.168.1.250
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: default
namespace: metallb-system
spec:
ipAddressPools:
- default-pool
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Example of metallb service
yml
apiVersion: v1
kind: Namespace
metadata:
name: my-ingresses-apps
---
apiVersion: v1
kind: Service
metadata:
name: my-app
namespace: my-ingresses-apps
annotations:
metallb.universe.tf/address-pool: default-pool
spec:
type: LoadBalancer
ports:
- name: http
port: 80
targetPort: 80
protocol: TCP
selector:
app: my-app
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
NAT
On your router, you need to set up a NAT rule to forward the traffic from the public IP to the metallb IP.