Configuring a UDP listener for the QUIC Protocol for a LoadBalancer Service
If the frontend protocol is UDP, the backend can use QUIC as its listening protocol. With QUIC, requests are routed based on the connection ID algorithm, ensuring that all requests sharing the same connection ID are forwarded to the same backend server. QUIC listeners offer low latency, high reliability, and avoid head-of-line blocking. They are ideal for mobile Internet scenarios and support seamless switching between Wi-Fi and cellular networks without requiring connections to be re-established.
Prerequisites
- A CCE standard or Turbo cluster is available, and the cluster version meets the following requirements:
- v1.28: v1.28.15-r80 or later
- v1.29: v1.29.15-r40 or later
- v1.30: v1.30.14-r40 or later
- v1.31: v1.31.14-r0 or later
- v1.32: v1.32.9-r0 or later
- v1.33: v1.33.7-r0 or later
- v1.34: v1.34.2-r0 or later
- Other clusters of later versions
- An available workload that supports QUIC has been deployed in the cluster for external access. If no workload is available, deploy a workload by referring to Creating a Deployment, Creating a StatefulSet, or Creating a DaemonSet.
Notes and Constraints
The load balancer is a dedicated one and the type is Network or Network & Application.
Step 1: Deploy an Application That Supports QUIC
Assume that the http3-server image supports QUIC and has been uploaded to an SWR image repository. http3-server is used as an example to describe how to create a Deployment.
- Log in to the CCE console and click the cluster name to access the cluster console.
- In the navigation pane, choose Workloads. In the upper right corner, click Create Workload.
- In the Basic Info area, enter the workload name. In this example, the workload name is http3-server. Retain the default settings for other parameters.
- In Container Information under Container Settings, specify the image name and tag. Retain the default settings for other parameters.
Parameter
Example
Image Name
Click Select Image. In the displayed dialog box, click Open Source Images under SWR Shared Edition, search for http3-server, select it, and click OK.
Image Tag
Select the latest image tag.
- Retain the default settings for other parameters and click Create Workload.
Step 2: Create a Load Balancer and Add a UDP listener for the QUIC Backend Protocol
You can use either of the following ways.
In this section, the sample certificate is cert-test. Replace it with the actual one.
- Log in to the CCE console and click the cluster name to access the cluster console.
- In the navigation pane, choose Services & Ingresses. In the upper right corner, click Create Service.
In this example, only the mandatory parameters for adding a UDP listener for the QUIC backend protocol are listed. Retain the default settings for other parameters. For details, see Using the CCE Console (New Version).
- Configure basic parameters.
Parameter
Description
Example Value
Service Type
Select LoadBalancer.
-
Service
Enter a name, which can be the same as the workload name.
http3-server
Namespace
Select the namespace that the workload belongs to.
default
Selector
Add the key and value of a pod label. The Service will be associated with the workload pods based on the label and direct traffic to the pods with this label.
You can also click Reference Workload Label to use the label of an existing workload. In the dialog box displayed, select a workload and click OK.
app:http3-server
- Configure load balancer parameters.
Parameter
Description
Example Value
Load Balancer
Select a load balance type and how the load balancer will be created. To enable UDP on the listener port of a dedicated load balancer, the type of the load balancer must be Network (TCP/UDP/TLS) or Network (TCP/UDP/TLS) & Application (HTTP/HTTPS).- Use existing: Only the load balancers in the same VPC as the cluster can be selected. If no load balancer is available, click Create Load Balancer to create one on the ELB console.
- Auto create: The load balancer will be created in the VPC that the cluster belongs to. For details, see Table 1.
An existing Dedicated load balancer of the Network (TCP/UDP/TLS) & Application (HTTP/HTTPS) type

- Configure access parameters.
Parameter
Description
Example Value
Service Affinity
Whether to route external traffic to a local node or a cluster-wide endpoint. For details, see Service Affinity (externalTrafficPolicy).- Cluster-level: The IP addresses and ports of all nodes in a cluster can access the workload associated with the Service. However, accessing the Service may result in performance deterioration due to route redirection, and the client's source IP address may not be obtainable.
- Node-level: Only the IP address and port of the node where the workload is located can access the workload associated with the Service. Accessing the Service will not result in a performance deterioration due to route redirection, and the client's source IP address can be obtained.
Cluster-level
Backend Routing Policy
- Global: All ports use the same backend routing policy. For details about the backend routing policy parameters, see Table 1. CAUTION:
When multiple ports are added, and some of them use different frontend protocols, the global backend routing policy cannot be applied across all protocols simultaneously. For any protocol to which the policy cannot be applied, CCE automatically falls back to the default configuration. For details about the mapping between the frontend and backend protocols of listeners and backend server groups, see Mapping Between Frontend and Backend Protocols for Load Balancing and Configuration Examples. Custom is recommended.
- Custom: Each port can have a unique backend routing policy. You can configure the policy in Port > Backend Routing Policy.
Global
Port
- Protocol: Select the protocol type based on your service requirements. In this example, UDP is used.
- Container Port: the port that the workload listens on. Typically, QUIC uses port 443 by default.
- Service Port: the port used by the Service.
- Listen on a port: The port ranges from 1 to 65535.
- Listen on ports: ELB allows you to create listeners that listen on ports within specified ranges. Each listener can support up to 10 non-overlapping port ranges.
To configure port ranges for load balancer listeners, ensure the following conditions are met:
- The cluster version must be v1.23.18-r0, v1.25.13-r0, v1.27.10-r0, v1.28.8-r0, v1.29.4-r0, v1.30.1-r0, or later.
- A dedicated load balancer must be used with TCP/UDP/TLS selected.
- This function requires ELB. Before using this function, check whether ELB supports full-port listening and forwarding for Layer 4 protocols in the current region.
- Frontend Protocol: Set the protocol of the load balancer listener for establishing connections with clients. If Frontend Protocol is set to UDP, the backend protocol QUIC can be used.
- Backend Routing Policy: If Backend Routing Policy is set to Custom, you can configure backend routing policies for ports that use different protocols. For details about the parameters, see Table 1.
NOTE:When a LoadBalancer Service is created, a random node port number (NodePort) is automatically generated.
- Protocol: UDP
- Container Port: 443
- Service Port: 443
- Frontend Protocol: UDP
Table 1 Parameters for configuring the Backend Routing Policy Parameter
Description
Example Value
Backend Protocol
The service protocol used by the load balancer's backend server group. TCP, HTTP, HTTPS, TLS, QUIC, and UDP are supported. For details about the mapping between the frontend and backend protocols of listeners and backend server groups, see Mapping Between Frontend and Backend Protocols for Load Balancing and Configuration Examples.
QUIC
Load Balancing Algorithm
Load balancers forward requests from clients to the corresponding backend servers based on the configured traffic routing policies.
- Weighted round robin: Requests are forwarded to different backend servers based on their configured weights.
- Weighted least connections: Requests are forwarded to the backend server with the smallest connections-to-weight ratio.
- Source IP hash: Requests are forwarded to the same backend server by hashing the source IP address, ensuring that all requests from the same source IP address are consistently routed to the same backend.
- Connection ID: Requests belonging to the same QUIC connection are forwarded to the same backend server by hashing the QUIC connection ID. This algorithm is available only when the backend protocol is QUIC.
- Hash Factor: The number of leading bytes the load balancer takes from the QUIC destination connection ID to compute the hash that pins a session to a backend server. The sum of the starting position and factor length should be equal to or less than 20.
Offset: 0 to 19 bytes. It defaults to 1.
Length: 1 to 20 bytes. It defaults to 3.
- Hash Factor: The number of leading bytes the load balancer takes from the QUIC destination connection ID to compute the hash that pins a session to a backend server. The sum of the starting position and factor length should be equal to or less than 20.
- Load Balancing Algorithm: Connection ID
- Hash Factor
- Offset: 1
- Length: 3

- Retain the default values for other parameters and click Create.
When adding a UDP listener for the QUIC protocol to a Service, note the following requirements:
- The load balancer must be a dedicated one and the type must be Network or Network & Application.
- The port protocol of the Service must be UDP.
In this example, an existing dedicated load balancer is used. The configuration example is as follows:
apiVersion: v1
kind: Service
metadata:
annotations:
kubernetes.io/elb.id: <your_elb_id> # In this example, an existing dedicated load balancer is used. Replace its ID with the ID of your dedicated load balancer.
kubernetes.io/elb.class: performance # A dedicated load balancer
# Add a backend server that uses QUIC.
kubernetes.io/elb.pools-options: |
[{
"protocol": "QUIC",
"lb_algorithm": "QUIC_CID"
}]
labels:
app: http3-server
name: http3-server
namespace: default
spec:
ports:
- name: cce-service-0
port: 443
protocol: UDP
targetPort: 443
selector:
app: http3-server
sessionAffinity: None
type: LoadBalancer | Parameter | Type | Description |
|---|---|---|
| kubernetes.io/elb.pools-options | String | Specifies the backend server group configuration, including the backend protocol, load balancing algorithm, and sticky sessions. The annotation value must be a JSON array. For details, see Table 3. CAUTION: After the kubernetes.io/elb.pools-options annotation is configured, the legacy annotation of load balancing algorithm (kubernetes.io/elb.lb-algorithm), sticky sessions (kubernetes.io/elb.session-affinity-option or kubernetes.io/elb.session-affinity-options), or backend protocol (kubernetes.io/elb.security-pool-protocol) cannot be configured. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| protocol | Yes | String | Definition: Protocol of a backend server. If the frontend protocol and port remain unchanged, the backend protocol cannot be modified. Constraints: The custom configuration must match the protocol of the frontend listener. For details about the matching rules, see Mapping Between Frontend and Backend Protocols for Load Balancing and Configuration Examples. No constraints apply to global configurations. Range: TCP, TLS, UDP, HTTP, HTTPS, or QUIC Default value: N/A |
| target_service_port | No | String | Definition: The backend server group to which the configuration applies. The value is composed of the protocol and port defined in spec.ports. For example, TCP:80 applies the configuration to the backend server group using TCP on port 80. If omitted or set to *, the configuration is treated as global and applies to all backend server groups. Constraints: For global configuration, the array length must be 1. A Service may contain listeners with different frontend protocols, but backend protocol options are limited. If this parameter is set globally and the backend protocol does not match the frontend protocol, the default value will be used. For details about the matching rules, see Mapping Between Frontend and Backend Protocols for Load Balancing and Configuration Examples. Other parameters depend on the backend protocol, so defaults may be applied when mismatches occur. Range: <protocol>:<port> Default value: None (Global configuration is used.) |
| lb_algorithm | Yes | String | Definition: The load balancing algorithm used by a backend server group Constraints:
Range:
Default value: If the backend protocol is QUIC, the value can only be QUIC_CID. The default value is ROUND_ROBIN for other protocols. |
| session_persistence | No | Definition: The sticky session settings Constraints: None Default value: Disabled | |
| quic_cid_hash_strategy | No | Definition: The multi-path forwarding behavior based on destination QUIC connection IDs Constraints: This parameter can be configured only when lb_algorithm is set to QUIC_CID. Default value: N/A |
Step 3: Access the Service
For web applications, the client that supports QUIC connections must support HTTP/3. For details, see HTTP3 (and QUIC).
- Configure a client to support HTTP/3. curl on Windows is used as an example. Run the command below to check whether curl supports HTTP/3. You can download the latest version of curl from Releases and Downloads.

- Copy the EIP and port of the load balancer and use curl to access the address. If the access is normal, the client and backend server can communicate with each other using HTTP/3 through QUIC.

Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot