Quick write up of using metallb with k8s on bare metal.
The steps at a high level:
- Deploy Kubernetes on bare metal (whatever that looks like for you).
juju deploy kubernetes-core
juju scp kubernetes-master/0:config ~/.kube/config
- Install metallb
kubectl apply -f https://raw.githubusercontent.com/google/metallb/v0.8.3/manifests/metallb.yaml
-
Reserve range for metallb to use in MAAS.
-
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