Metallb L2 LoadBalancer Ingress for K8S on Metal



Quick write up of using metallb with k8s on bare metal.

The steps at a high level:

  1. Deploy Kubernetes on bare metal (whatever that looks like for you).
juju deploy kubernetes-core
juju scp kubernetes-master/0:config ~/.kube/config
  1. Install metallb
kubectl apply -f
  1. Reserve range for metallb to use in MAAS.

  2. Configure metallb (notice the ip range used is the same range reserved in MAAS).

apiVersion: v1
kind: ConfigMap
  namespace: metallb-system
  name: config
  config: |
    - name: default
      protocol: layer2

At this point you should be able to deploy things in juju and expose them via the metallb loadbalancer.


# Add your k8s cloud to your controller
cat ~/.kube/config | juju add-k8s pdl-k8s --cloud=pdl-maas-cloud --client --controller=manual 
# Add the k8s model
juju add-model bdxmodel pdl-k8s
# Deploy the k8s application charm
juju deploy cs:~omnivector/jupyter-k8s
# Expose the application
juju expose jupyter-k8s

juju status

Model     Controller  Cloud/Region     Version  SLA          Timestamp
bdxmodel  manual      pdl-k8s/default  2.7-rc1  unsupported  23:42:39Z

App          Version  Status  Scale  Charm        Store       Rev  OS          Address      Notes
jupyter-k8s           active      1  jupyter-k8s  jujucharms   13  kubernetes  exposed

Unit            Workload  Agent  Address     Ports     Message
jupyter-k8s/0*  active    idle  9999/TCP  

Access the Jupyter notebook at on your host network.

[2] Past, Present, Future - What I've Learned From Packaging Spark Applications

Know that it’s not quite the point of the post, but that looks like one of the quickest ways to get a shared JupyterHub up I’ve seen.