Skip to content

Commit

Permalink
Merge pull request #17 from vidhya03/metallb
Browse files Browse the repository at this point in the history
Blog on metalLb
  • Loading branch information
vidhya03 authored May 1, 2023
2 parents 005abd8 + cf12037 commit 356ec91
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 1 deletion.
54 changes: 54 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"configurations": [
{
"type": "pwa-msedge",
"name": "Launch Microsoft Edge",
"request": "launch",
"runtimeArgs": [
"--remote-debugging-port=9222"
],
"url": "http://localhost:1313/", // Provide your project's url to finish configuring
"presentation": {
"hidden": true
}
},
{
"type": "pwa-msedge",
"name": "Launch Microsoft Edge in headless mode",
"request": "launch",
"runtimeArgs": [
"--headless",
"--remote-debugging-port=9222"
],
"url": "http://localhost:1313/", // Provide your project's url to finish configuring
"presentation": {
"hidden": true
}
},
{
"type": "vscode-edge-devtools.debug",
"name": "Open Edge DevTools",
"request": "attach",
"url": "http://localhost:1313/", // Provide your project's url to finish configuring
"presentation": {
"hidden": true
}
}
],
"compounds": [
{
"name": "Launch Edge Headless and attach DevTools",
"configurations": [
"Launch Microsoft Edge in headless mode",
"Open Edge DevTools"
]
},
{
"name": "Launch Edge and attach DevTools",
"configurations": [
"Launch Microsoft Edge",
"Open Edge DevTools"
]
}
]
}
2 changes: 1 addition & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ enableEmoji = true
tileColor = "#da532c"
# Search config
[languages.en.params.search]
enable = true
enable = false
# type of search engine ("lunr", "algolia")
type = "algolia"
# max index length of the chunked content
Expand Down
Binary file added content/posts/metallb/fatured-metallb.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 78 additions & 0 deletions content/posts/metallb/index.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
title: "Getting started with MetalLB - A Load Balancer for Kubernetes on Bare Metal"
date: 2023-05-01T01:11:15+05:30
lastmod: 2023-05-01T01:11:15+05:30
draft: false
author: "Vidhya"
description: "Getting started with MetalLB - A Load Balancer for Kubernetes on Bare Metal"

tags: ["tools", "k8s"]
categories: ["git"]

resources:
- name: "featured-image"
src: "fatured-metallb.jpg"

toc:
auto: true
---


## Introduction
- MetalLB is an <a href="https://github.com/metallb/metallb"> <i class="fab fa-github fa-fw"></i> </a>
open-source load balancer for Kubernetes on bare metal hardware.
- It solves the problem of load balancing in bare metal environments, where it's not natively available, leading to scalability and high availability limitations.
- MetalLB supports layer 2 and layer 3 modes and can be customized to work with specific network topologies.
- It's a reliable and scalable choice for organizations running Kubernetes on bare metal hardware.
- MetalLB using standard routing protocols.

## Why - MetalLB

- Kubernetes lacks a native implementation of network load-balancers (Services of type LoadBalancer) for bare metal clusters.
- The built-in Network LB implementations in Kubernetes are designed to work with IaaS platforms like **GCP, AWS, and Azure**.
- When attempting to create Load Balancers in a bare metal environment using the built-in Network LB implementations, they will remain in a **pending** state indefinitely.
- This limitation can lead to scalability and high availability issues for organizations running Kubernetes on bare metal hardware.

## Prerequisites
- Basic understanding of Kubernetes is necessary to use MetalLB.
- You should know how to deploy applications on Kubernetes and create/manage Kubernetes objects using kubectl or `YAML manifests`.
- MetalLB is designed to work with `Kubernetes clusters` running on bare metal hardware.

## Installation

Installing MetalLB in your Kubernetes cluster is a straightforward process. You can install MetalLB using either kubectl or Helm, depending on your preference.

Here are the steps to install MetalLB using kubectl:


```sh
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.9/config/manifests/metallb-native.yaml
```
The above command will deploy MetalLB to your cluster, under the **metallb-system** namespace.

## Configurations

In order to assign IP to services. MetalLB must be instructed to do via **IPAddressPool**.

Layer 2 mode is the simplest to configure: in many cases, you don’t need any protocol-specific configuration, **only IP addresses**.

For example, the following configuration gives MetalLB control over IPs from **152.16.16.240** to **152.16.16.250**


{{< gist vidhya03 e7de7aa070e90e325d4346831d7ea2dd ipaddresspool.yaml >}}

In order to advertise the IP coming from an IPAddressPool, an **L2Advertisement** instance must be associated to the IPAddressPool.


{{< gist vidhya03 e7de7aa070e90e325d4346831d7ea2dd l2advertisement.yaml >}}

## Conclusion

- MetalLB is a reliable and scalable solution for load balancing on bare metal Kubernetes clusters. It is based on standard routing protocols and can handle large numbers of services and endpoints.
- MetalLB is an open-source project that is available to anyone to use and contribute to. It is developed by a community of developers and maintained by the MetalLB team, ensuring ongoing development and support.

{{< admonition type=tip open=true >}}
Personally I use MetalLB for local on prem setup and automation.
{{< /admonition >}}


0 comments on commit 356ec91

Please sign in to comment.