DEV Community

Joseph D. Marhee
Joseph D. Marhee

Posted on • Originally published at Medium on

MetalLB Kubernetes LoadBalancer with

I recently began using MetalLB to manage layer 2 and 3 networks in my cluster’s datacenter to provide LoadBalancer type Kubernetes Service resources in a bare-metal cluster:


So, with a configuration like this for MetalLB:

apiVersion: v1
kind: Namespace
  name: metallb-system
apiVersion: v1
kind: ConfigMap
  namespace: metallb-system
  name: config
  config: |
    - name: provider-network
      protocol: layer2
      - ****

your Address pool, would serve out, for the lifetime of your service’s LoadBalancer, an address from that pool. This can be exceptionally helpful, particularly for a service like the router to get an IP from the upstream Layer 2 or 3 network services, as required.

When you install MetalLB:

kubectl create -f metallb-config.yaml ;\
kubectl apply -f

any Service connected to that provider network (meaning anything type: LoadBalancer ) will get an address from MetalLB. So, when you install Fission:

Serverless Functions for Kubernetes

you’ll see a service like the router which will act as the entry point to your tasks that have URI paths configured, that has an external IP configured:

jmarhee@controller:~$ kubectl get service router -n fission
router LoadBalancer **** 80:31180/TCP 9m40s

and then all tasks are accessible at, in this case:<task route>

Creating a task with a --url argument will make the task HTTP trigger accessible:

**jmarhee@controller:~$** fission function create --name hello --env nodejs --code hello.js **--url /hello**
Package 'hello-js-9tb7' created
function 'hello' created
route created: GET /hello -> hello

**jmarhee@controller:~$** curl [****](
hello, world!

This is a fairly straight-forward use case for, both, the MetalLB external-ip automation, and the ingress setup by default with Fission, however, this creates some great automation opportunities for bare-metal Kubernetes (or those not on managed cloud services like AWS or GCP, or a Kubernetes SaaS with an available cloud controller to provision and abstract resources) making this a great utility for many network setups you might be using upstream of your cluster to provide services:

MetalLB, bare metal load-balancer for Kubernetes

Coupled with other features native to Kubernetes, you can more tightly control access and security options for loadbalanced services like Fission (i.e. TLS, with this services as a backend):

Using Kubernetes TLS Ingress with Platform9 Fission FaaS endpoints

Top comments (0)