2018-09-04 20:17:23 +08:00
|
|
|
# Deploy MetalLB into Kubespray/Kubernetes
|
2020-05-18 16:17:36 +08:00
|
|
|
|
|
|
|
MetalLB hooks into your Kubernetes cluster, and provides a network load-balancer implementation.
|
|
|
|
In short, it allows you to create Kubernetes services of type "LoadBalancer" in clusters that
|
|
|
|
don't run on a cloud provider, and thus cannot simply hook into paid products to provide load-balancers.
|
|
|
|
This playbook aims to automate [this](https://metallb.universe.tf/concepts/layer2/).
|
|
|
|
It deploys MetalLB into Kubernetes and sets up a layer 2 load-balancer.
|
2018-09-04 20:17:23 +08:00
|
|
|
|
|
|
|
## Install
|
2019-06-11 15:20:21 +08:00
|
|
|
|
2020-05-18 16:17:36 +08:00
|
|
|
Defaults can be found in contrib/metallb/roles/provision/defaults/main.yml.
|
|
|
|
You can override the defaults by copying the contents of this file to somewhere in inventory/mycluster/group_vars
|
|
|
|
such as inventory/mycluster/groups_vars/k8s-cluster/addons.yml and making any adjustments as required.
|
|
|
|
MetalLB allocates external IP addresses from this ip_range option, so you need to update this ip_range option
|
|
|
|
at least for suiting your network environment.
|
|
|
|
|
|
|
|
```
|
2019-03-18 16:43:15 +08:00
|
|
|
ansible-playbook --ask-become -i inventory/sample/hosts.ini contrib/metallb/metallb.yml
|
2018-09-04 20:17:23 +08:00
|
|
|
```
|