Metallb L2 LoadBalancer Ingress for K8S on Metal

networking

#1

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 https://raw.githubusercontent.com/google/metallb/v0.8.3/manifests/metallb.yaml
  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
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
              - 10.30.111.0-10.30.111.254

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

Example

# 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  10.30.111.0  exposed

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

Access the Jupyter notebook at http://10.30.111.0:9999 on your host network.


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

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.