Using MetalLB for on-premise or bare-metal Direktiv

Modified on Mon, 22 May, 2023 at 11:06 PM

For on-premise or bare-metal installations Kubernetes requires a LoadBalancer. This article shows how to use MetalLB for Direktiv.


MetalLB can be easily installed via Helm. The first step is to add the Helm repository.


helm repo add metallb https://metallb.github.io/metallb

After adding the repository the installation is done with the following command:


helm install metallb metallb/metallb
Please visit the MetalLB Helm chart Github page for additional installation options and the MetalLB installation page for detailed instructions.


Now the IP ranges or single IPs have to be configured with Kubernetes Custom Resource Definitions (CRDs). The IP can be a single one or multiple different ranges depending on the infrastructure. The following YAML definition is an example of this CRD:

apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: myip
  namespace: default
spec:
  addresses:
  - 192.168.0.199/32

After creating the ranges the IPs have to be announced. Usually Layer 2 will work in almost all environments.


apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
  name: ipadvertise
  namespace: default


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article