Set up UPF load balancing
Important
User Plane Function (UPF) load balancing is an alpha feature and is not suitable for production deployments.
Fast Path Provider (FPP) 3.2.0 can run a Connectivity Gateway (CGW) as a UPF load balancer (UPF-LB) for a pool of UPF instances. UPF-LB sends the traffic of each session to the UPF that serves it. An external controller places each session on a UPF and publishes the placement in a NATS JetStream key-value (KV) bucket. An example of such a controller is the UPF Session Controller (UPF-SC). UPF-LB watches the bucket and applies each change to the Vector Packet Processing (VPP) forwarding tables.
UPF-LB supports IPv4 only.
Prerequisites
Before you set up UPF load balancing, make sure that you have:
- VPP Operator 3.2.0, upgraded as described in 3.1.0 → 3.2.0
- A
CGWDeploymenton the FPP 3.2.0 revision of thecgw-genericComposition - NATS with JetStream enabled
- A KV bucket that a controller writes to
How it works
UPF-LB handles traffic per Network Instance (NWI). Each NWI has an external side, facing the peer network, and an internal side, facing the UPF pool. Each side has its own VPP table. The following table describes the two NWI types:
UPF-LB answers GTP-U echo requests to the ownIP of an access NWI itself.
Traffic that is not GTP-U or not for a UE pool follows the normal routes of the table.
KV bucket key format
The controller writes one key for each TEID or UE address:
The key kinds and selectors work as follows:
gtpukeys use theaccessside and a TEID as the selector.ip4dkeys use thesgiside and a UE IPv4 address as the selector, with underscores in place of the dots, for example203_0_113_10.- Selector
0is the catch-all of the NWI for traffic that matches no other key.
Without a catch-all, UPF-LB drops the traffic that matches no key.
UPF-LB watches only gtpu.> and ip4d.>, so other applications can share the bucket.
After a reconnect, UPF-LB replays the bucket and removes the entries that the controller deleted while UPF-LB was disconnected.
Configure the CGWDeployment
Add the UPF-LB configuration to a CGWDeployment. Give the CGW access to NATS.
If NATS requires authentication, create a Secret with the credentials file in the CGW namespace on the Core Cluster. Store the file under the
user.credskey:bashConfigure UPF-LB with spec.upflbConfig.spec of the
CGWDeployment. A non-empty spec enables UPF-LB in the CGW and creates aUPFLBConfigresource in the Core Cluster:yamlIf the NATS server does not require authentication, omit the following fields:
- nats.creds
- additionalVolumes
- additionalVolumeMounts
The manifest also needs the
RoutingTableandVPPInterfaceresources of both sides in spec.routingTables and spec.vppInterfaces, as for any other CGW.Apply the
CGWDeploymenton the Management Cluster:Caution
If you apply this configuration to an existing CGW, the CGW pods restart, and traffic through the CGW stops until the pods are ready.
bash
The CGW pod starts and becomes ready after UPF-LB receives a full copy of the bucket.
The following table describes the spec.upflbConfig.spec parameters:
Readiness and metrics
A new CGW pod stays not ready until UPF-LB receives a full copy of the bucket. This way, the pod never takes traffic without a forwarding table. After that, the pod stays ready even if NATS becomes unavailable, and keeps forwarding with the entries it holds.
The CGW exports UPF-LB metrics with the vpp_upflb_ prefix.
The most important ones are:
For the full list of UPF-LB metrics, see UPF-LB metrics.
Verification
Run the following commands to check the UPF-LB state in the fpp container of the CGW pod on the Core Cluster:
Check that UPF-LB is connected to NATS:
bashSample output:
textThe
readyline shows1while UPF-LB is connected to NATS. Thesnapshotline shows1after UPF-LB replays the whole bucket. If thereadyline shows0, thestatusline shows the NATS error.List the NWIs:
bashSample output:
textThe output lists each NWI of spec.upflbConfig.spec.nwis with its table IDs. The
enabled interfaceslist shows the interfaces of spec.upflbConfig.spec.interfaces.Check the UE pools:
bashSample output:
textThe
nextcolumn showsdropwhile the NWI has noip4dcatch-all entry.After the controller publishes sessions, list the entries that UPF-LB received from the bucket:
bashSample output:
textUPF-LB holds a forwarding entry for each TEID and each UE address.
yesin theinstcolumn means that UPF-LB installed the entry in the forwarding tables. Thenextcolumn shows the address of the UPF that serves the entry, on the NWI of the entry. The command lists up to 100 entries. To list up to10000entries, addlimit {N}to the command.(Optional) List the entries that the Data Plane uses:
bash
When all checks pass, UPF-LB sends the traffic that matches an installed entry to the UPF in the next column of that entry.