Kubernetes Load Balancer for IPAddressPooling and Exposing Internal Kubernetes Server with L2Advertisement and BGPAdvertisement.

Helm Installation (Recommended):

helm repo add metallb <https://metallb.github.io/metallb>
helm install metallb metallb/metallb -n metallb-system --create-namespace
# Ini klo misalnya mau aneh"
helm install metallb metallb/metallb -f values.yaml

YAML File Installation:

kubectl edit configmap -n kube-system kube-proxy
# kube-proxy ConfigMap
apiVersion: v1
data:
  config.conf: |-
		ipvs:
      excludeCIDRs: []
      minSyncPeriod: 0s
      scheduler: rr
      strictARP: true     # Change this to **true**
      syncPeriod: 30s
      tcpFinTimeout: 0s
      tcpTimeout: 0s
      udpTimeout: 0s
kubectl apply -f <https://raw.githubusercontent.com/metallb/metallb/v0.14.8/config/manifests/metallb-native.yaml>

# Cek dlu udah running semua ga podnya
kubectl get pods -A

Buat Address Poolnya dlu buat di assign IPnya

nano pool-1.yaml
# pool-1.yaml
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: first-pool
  namespace: metallb-system
spec:
  addresses:
  - 192.168.100.200-192.168.100.250
  
# Create the IP Adress Pool
kubectl create -f pool-1.yaml

Apply address poolnya supaya bisa dibagiā€ in ke load balancer services sebagai external IP

nano l2-advertisement.yaml
# l2-advertisement.yaml
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
  name: l2
  namespace: metallb-system
spec:
  ipAddressPools:
  - first-pool
  

kubectl create -f l2-advertisement.yaml