Kubernetes cluster - MetalLB

KevKev
1 min read

One of the usage which I used for Kubernetes to expose to my router ip is through the usage of MetalLB.

In your Kubernetes control plane, perform this. This will create the pods across the worker nodes

kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.8/config/manifests/metallb-native.yaml

In order to use metalLB, you need to provide it a range of ips. Create a file called metallb-ips.yaml

apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: default
  namespace: metallb-system
spec:
  addresses:
  - 192.168.1.200-192.168.1.220

Next in order to use this

kubectl apply -f metallb-ips.yaml

For example if I would want to expose the IP of the load balancer so it can communicate with on of my App pods name squid. Applying this script using kubectl will use on of the ip range which is made available.

apiVersion: v1
kind: Service
metadata:
  name: squid-service
spec:
  type: LoadBalancer
  selector:
    app: squid
  ports:
    - protocol: TCP
      port: 3128
      targetPort: 3128
0
Subscribe to my newsletter

Read articles from Kev directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Kev
Kev