For AI agents: this documentation is indexed for you in llms.txt, and all of it in /llms.txt. Every page is also available as markdown: append .md to its address.

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 CGWDeployment on the FPP 3.2.0 revision of the cgw-generic Composition
  • 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:

text

The key kinds and selectors work as follows:

  • gtpu keys use the access side and a TEID as the selector.
  • ip4d keys use the sgi side and a UE IPv4 address as the selector, with underscores in place of the dots, for example 203_0_113_10.
  • Selector 0 is 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.

  1. 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.creds key:

    bash
  2. Configure UPF-LB with spec.upflbConfig.spec of the CGWDeployment. A non-empty spec enables UPF-LB in the CGW and creates a UPFLBConfig resource in the Core Cluster:

    yaml

    If the NATS server does not require authentication, omit the following fields:

    • nats.creds
    • additionalVolumes
    • additionalVolumeMounts

    The manifest also needs the RoutingTable and VPPInterface resources of both sides in spec.routingTables and spec.vppInterfaces, as for any other CGW.

  3. Apply the CGWDeployment on 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:

  1. Check that UPF-LB is connected to NATS:

    bash

    Sample output:

    text

    The ready line shows 1 while UPF-LB is connected to NATS. The snapshot line shows 1 after UPF-LB replays the whole bucket. If the ready line shows 0, the status line shows the NATS error.

  2. List the NWIs:

    bash

    Sample output:

    text

    The output lists each NWI of spec.upflbConfig.spec.nwis with its table IDs. The enabled interfaces list shows the interfaces of spec.upflbConfig.spec.interfaces.

  3. Check the UE pools:

    bash

    Sample output:

    text

    The next column shows drop while the NWI has no ip4d catch-all entry.

  4. After the controller publishes sessions, list the entries that UPF-LB received from the bucket:

    bash

    Sample output:

    text

    UPF-LB holds a forwarding entry for each TEID and each UE address. yes in the inst column means that UPF-LB installed the entry in the forwarding tables. The next column 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 to 10000 entries, add limit {N} to the command.

  5. (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.