Skip to main content
Skip table of contents

Pre-provisioned Configure MetalLB

It is recommended that an external load balancer(LB) be the control plane endpoint. To distribute request load among the control plane machines, configure the load balancer to send requests to all the control plane machines. Configure the load balancer to send requests only to control plane machines that are responding to API requests. If you do not have one, you can use Metal LB to create a MetalLB configmap for your Pre-provisioned infrastructure.

Choose one of the following two protocols you want to use to announce service IPs. If your environment is not currently equipped with a load balancer, you can use MetalLB. Otherwise, your own load balancer will work and you can continue the installation process.

To use MetalLB, create a MetalLB configMap for your Pre-provisioned infrastructure. MetalLB uses one of two protocols for exposing Kubernetes services:

  • Layer 2, with Address Resolution Protocol (ARP)

  • Border Gateway Protocol (BGP

Select one of the following procedures to create your MetalLB manifest for further editing.

Layer 2 Configuration

Layer 2 mode is the easiest to configure in many cases, because you do not need any protocol-specific configuration, only IP addresses.

Layer 2 mode does not require the IPs to be bound to the network interfaces of your worker nodes. It works by responding to ARP requests on your local network directly, to give the machine’s MAC address to clients.

  • MetalLB IP address ranges/CIDRs should be within the node’s primary network subnet.

  • MetalLB IP address ranges/CIDRs and node subnet should not conflict with the Kubernetes cluster pod and service subnets.

For example, the following configuration gives MetalLB control over IPs from 192.168.1.240 to 192.168.1.250, and configures Layer 2 mode:

The following values are generic, enter your specific values into the fields where applicable.

CODE
cat << EOF > metallb-conf.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
      - 192.168.1.240-192.168.1.250
EOF

After completion, run the following kubectl command.

CODE
kubectl apply -f metallb-conf.yaml

BGP Configuration

For a basic configuration featuring one BGP router and one IP address range, you need 4 pieces of information:

  • The router IP address that MetalLB should connect to,

  • The router’s AS number,

  • The AS number MetalLB should use,

  • An IP address range expressed as a CIDR prefix.

As an example, if you want to give MetalLB the range 192.168.10.0/24 and AS number 64500, and connect it to a router at 10.0.0.1 with AS number 64501, your configuration will look like:

The following values are generic, enter your specific values into the fields where applicable.

CODE
cat << EOF > metallb-conf.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    peers:
    - peer-address: 10.0.0.1
      peer-asn: 64501
      my-asn: 64500
    address-pools:
    - name: default
      protocol: bgp
      addresses:
      - 192.168.10.0/24
EOF

After completion, run the following kubectl command.

CODE
kubectl apply -f metallb-conf.yaml

Next Step

Pre-provisioned Modify the Calico Installation

If none of the customizations apply, continue to installation instructions for your environment:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.