Browse Source
Support Calico advertisement of MetalLB LoadBalancer IPs (#7593)
Support Calico advertisement of MetalLB LoadBalancer IPs (#7593)
* add initial MetalLB docs * metallb allow disabling the deployment of the metallb speaker * calico>=3.18 allow using calico to advertise service loadbalancer IPs * Document the use of MetalLB and Calico * clean MetalLB docspull/7612/head
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 110 additions and 17 deletions
Split View
Diff Options
-
2README.md
-
81docs/metallb.md
-
1inventory/sample/group_vars/k8s_cluster/addons.yml
-
5inventory/sample/group_vars/k8s_cluster/k8s-net-calico.yml
-
17roles/kubernetes-apps/metallb/README.md
-
1roles/kubernetes-apps/metallb/defaults/main.yml
-
10roles/kubernetes-apps/metallb/templates/metallb.yml.j2
-
3roles/network_plugin/calico/defaults/main.yml
-
7roles/network_plugin/calico/tasks/install.yml
@ -0,0 +1,81 @@ |
|||
# MetalLB |
|||
|
|||
MetalLB hooks into your Kubernetes cluster, and provides a network load-balancer implementation. |
|||
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 3rd party products to provide load-balancers. |
|||
The default operationg mode of MetalLB is in ["Layer2"](https://metallb.universe.tf/concepts/layer2/) but it can also operate in ["BGP"](https://metallb.universe.tf/concepts/bgp/) mode. |
|||
|
|||
## Install |
|||
|
|||
You have to explicitly enable the MetalLB extension and set an IP address range from which to allocate LoadBalancer IPs. |
|||
|
|||
```yaml |
|||
metallb_enabled: true |
|||
metallb_speaker_enabled: true |
|||
metallb_ip_range: |
|||
- 10.5.0.0/16 |
|||
``` |
|||
|
|||
By default only the MetalLB BGP speaker is allowed to run on control plane nodes. If you have a single node cluster or a cluster where control plane are also worker nodes you may need to enable tolerations for the MetalLB controller: |
|||
|
|||
```yaml |
|||
metallb_controller_tolerations: |
|||
- key: "node-role.kubernetes.io/master" |
|||
operator: "Equal" |
|||
value: "" |
|||
effect: "NoSchedule" |
|||
- key: "node-role.kubernetes.io/control-plane" |
|||
operator: "Equal" |
|||
value: "" |
|||
effect: "NoSchedule" |
|||
``` |
|||
|
|||
## BGP Mode |
|||
|
|||
When operating in BGP Mode MetalLB needs to have defined upstream peers: |
|||
|
|||
```yaml |
|||
metallb_protocol: bgp |
|||
metallb_ip_range: |
|||
- 10.5.0.0/16 |
|||
metallb_peers: |
|||
- peer_address: 192.0.2.1 |
|||
peer_asn: 64512 |
|||
my_asn: 4200000000 |
|||
- peer_address: 192.0.2.2 |
|||
peer_asn: 64513 |
|||
my_asn: 4200000000 |
|||
``` |
|||
|
|||
When using calico >= 3.18 you can replace MetalLB speaker by calico Service LoadBalancer IP advertisement. |
|||
See [calico service IPs advertisement documentation](https://docs.projectcalico.org/archive/v3.18/networking/advertise-service-ips#advertise-service-load-balancer-ip-addresses). |
|||
In this scenarion you should disable the MetalLB speaker and configure the `calico_advertise_service_loadbalancer_ips` to match your `metallb_ip_range` |
|||
|
|||
```yaml |
|||
metallb_speaker_enabled: false |
|||
metallb_ip_range: |
|||
- 10.5.0.0/16 |
|||
calico_advertise_service_loadbalancer_ips: "{{ metallb_ip_range }}" |
|||
``` |
|||
|
|||
If you have additional loadbalancer IP pool in `metallb_additional_address_pools`, ensure to add them to the list. |
|||
|
|||
```yaml |
|||
metallb_speaker_enabled: false |
|||
metallb_ip_range: |
|||
- 10.5.0.0/16 |
|||
metallb_additional_address_pools: |
|||
kube_service_pool_1: |
|||
ip_range: |
|||
- 10.6.0.0/16 |
|||
protocol: "bgp" |
|||
auto_assign: false |
|||
kube_service_pool_2: |
|||
ip_range: |
|||
- 10.10.0.0/16 |
|||
protocol: "bgp" |
|||
auto_assign: false |
|||
calico_advertise_service_loadbalancer_ips: |
|||
- 10.5.0.0/16 |
|||
- 10.6.0.0/16 |
|||
- 10.10.0.0/16 |
|||
``` |
@ -1,17 +0,0 @@ |
|||
# Deploy MetalLB into Kubespray/Kubernetes |
|||
|
|||
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 addon aims to automate [MetalLB in layer 2 mode](https://metallb.universe.tf/concepts/layer2/) |
|||
or [MetalLB in BGP mode](https://metallb.universe.tf/concepts/bgp/). |
|||
It deploys MetalLB into Kubernetes and sets up a layer 2 or BGP load-balancer. |
|||
|
|||
## Install |
|||
|
|||
In the default, MetalLB is not deployed into your Kubernetes cluster. |
|||
You can override the defaults by copying the contents of roles/kubernetes-apps/metallb/defaults/main.yml |
|||
to somewhere in inventory/mycluster/group_vars such as inventory/mycluster/groups_vars/k8s_cluster/addons.yml |
|||
and updating metallb_enabled option to `true`. |
|||
In addition you need to update metallb_ip_range option on the addons.yml at least for suiting your network |
|||
environment, because MetalLB allocates external IP addresses from this metallb_ip_range option. |
Write
Preview
Loading…
Cancel
Save