Skip to content

Commit

Permalink
Add load balancer and IP pool docs
Browse files Browse the repository at this point in the history
Signed-off-by: Canwu Yao <yaocanwu@gmail.com>
Co-authored-by: vickyhella <vickyhella@hotmail.com>
Co-authored-by: Lucas Saintarbor <lucas.saintarbor@suse.com>
  • Loading branch information
3 people committed Jun 1, 2023
1 parent abaabf0 commit 9b089ab
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
40 changes: 40 additions & 0 deletions docs/networking/ippool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
sidebar_position: 5
sidebar_label: IP Pool
title: "IP Pool"
keywords:
- IP Pool
---
_Available as of v1.2.0_

Harvester IP Pool is a built-in IP address management (IPAM) solution exclusively available to Harvester Load Balancers (LBs).

## Features
- **Multiple IP ranges:** Each IP pool can contain multiple IP ranges or CIDRs.
- **Allocation history:** The IP pool keeps track of the allocation history of every IP address and prioritizes assigning previously allocated addresses.
- **Scope:** Restrict the IP pool to a particular network, project, namespace, or guest cluster.

## Selection policy
An IP pool can have specific scopes, and you can specify the corresponding requirements in the LB. The IP pool that meets the requirements will automatically assign IP addresses for the LB.

- The LB uses the annotations below to express the requirements, and all the annotations are optional.
- `loadbalancer.harvesterhci.io/network` specifies the location of the network for the guest cluster.
- `loadbalancer.harvesterhci.io/project` and `loadbalancer.harvesterhci.io/namespace` specify the project and namespace of the VMs that comprise the guest cluster.
- `loadbalancer.harvesterhci.io/cluster` specifies the name of the guest cluster.
- The IP pool has a selector, including network and scope, to match the requirements of the LB.
- Network is a hard condition. The optional IP pool must match the value of the LB annotation `loadbalancer.harvesterhci.io/network`.
- Every IP pool, except the global IP pool, has a unique scope different from others if its priority is `0`. The project, namespace, or cluster name of LBs should be in the scope of the IP pool if they want to get an IP from this pool.
- `spec.selector.priority` specifies the priority of the IP Pool. The larger the number, the higher the priority. If the priority is not `0`, the value should differ. The priority helps you to migrate the old IP pool to the new one.
- If the IP Pool has a scope that matches all projects, namespaces, and guest clusters, it's called a global IP pool. It's only allowed to have one global IP pool. If there is no IP pool matching the requirements of the LB, the IPAM will allocate an IP from the global IP pool if it exists.

## Allocation policy
- The IP pool prefers to allocate the previously assigned IP according to the given history.
- IP allocation follows the round-robin policy.

## How to create
To create a new VM load balancer:

1. Go to the **Networks > IP Pools** page and select **Create**.
1. Specify the **Name** of the IP pool.
1. Go to the **Range** tab to specify the **IP ranges** for the IP pool. You can add multiple IP ranges.
1. Go to the **Selector** tab to specify the **Scope** and **Priority** of the IP pool.
46 changes: 46 additions & 0 deletions docs/networking/loadbalancer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
sidebar_position: 4
sidebar_label: Load Balancer
title: "Load Balancer"
keywords:
- Load Balancer
---
_Available as of v1.2.0_

Harvester load balancer is a built-in Layer 4 load balancer that can be used to distribute incoming traffic across workloads deployed on Harvester virtual machines (VMs) or guest Kubernetes clusters.

## VM load balancer

### Features
Harvester VM load balancer supports the following features:

- **Address assignment:** Get the LB IP address from a DHCP server or a pre-defined IP pool.
- **Protocol support:** Supports both TCP and UDP protocols for load balancing.
- **Multiple listeners:** Create multiple listeners to handle incoming traffic on different ports or with other protocols.
- **Label selector:** The LB uses label selectors to match the backend servers. Therefore, you must configure the corresponding labels for the backend VMs you want to add to the LB.
- **Health check:** Only send traffic to healthy backend instances.

### Limitations
Harvester VM load balancer has the following limitations:

- **Namespace restriction:** This restriction is in place to facilitate permission management and ensures the LB only uses VMs in the same namespace as the backend servers.
- **IPv4-only:** The LB is only compatible with IPv4 addresses for VMs.
- **Guest agent installation:** Installing the guest agent on each backend VM is required to obtain IP addresses.
- **Connectivity Requirement:** Network connectivity must be established between backend VMs and Harvester hosts. When a VM has multiple IP addresses, the LB will select the first one as the backend address.
- **Access Restriction:** The VM LB address is exposed only within the same network as the Harvester hosts. If you wish to access the LB from outside the network, you must provide a route from outside to the LB address.

### How to create
To create a new VM load balancer:
1. Go to the **Networks > Load Balancer** page and select **Create**.
1. Select the **Namespace** and specify the **Name**.
1. Go to the **Basic** tab to choose the IPAM mode, which can be **DHCP** or **IP Pool**. If you select **IP Pool**, you must prepare an IP pool first, specify the IP pool name, or choose **auto**. If you choose **auto**, the LB will automatically select an IP pool according to the matching rules.
1. Go to the **Listeners** tab to add listeners. You must specify the **Port**, **Protocol**, and **Backend Port** for each listener.
1. Go to the **Backend Server Selector** tab to add label selectors. If you want to add the VM to the LB, go to the **Virtual Machine > Instance Labels** tab to add the corresponding labels to the VM.
1. Go to the **Health Check** tab to enable health check and specify the parameters, including the **Port**, **Success Threshold**, **Failure Threshold**, **Interval**, and **Timeout** if the backend service supports health check.

## Guest Kubernetes cluster load balancer
In conjunction with Harvester Cloud Provider, the Harvester load balancer provides load balancing for LB services in the guest cluster.

When you create, update, or delete a LB service on a guest cluster with Harvester Cloud Provider, the Harvester Cloud Provider will create a Harvester LB automatically.

Refer to [Harvester Cloud Provider](/rancher/cloud-provider.md) for more details.

0 comments on commit 9b089ab

Please sign in to comment.