ALB has been deprecated. Please use the ingress-nginx-operator or envoy-gateway instead.
ALB is a custom resource that represents a load balancer. The alb-operator, which is embedded by default in all clusters, watches for create/update/delete operations on ALB resources and creates corresponding deployments and services in response.
For each ALB, a corresponding Deployment watches all Frontends and Rules attached to that ALB and routes requests to backends based on those configurations.
The high availability of the Load Balancer requires a VIP. Please refer to Configure VIP.
There are three parts to an ALB configuration.
resource related field describes the deployment configuration for the alb.
| Field | Type | Description |
|---|---|---|
.spec.config.nodeSelector | map[string]string | the node selector for the alb |
.spec.config.replicas | int,optional default 3 | the number of replicas for the alb |
.spec.config.resources.limits | k8s container-resource,optional | limit of nginx container of alb |
.spec.config.resources.requests | k8s container-resource,optional | request of nginx container of alb |
.spec.config.resources.alb.limits | k8s container-resource,optional | limit of alb container of alb |
.spec.config.resources.alb.requests | k8s container-resource,optional | request of alb container of alb |
.spec.config.antiAffinityKey | string,optional default local | k8s antiAffinityKey |
Networking fields describe how to access the ALB. For example, in host mode, alb will use hostnetwork, and you can access the ALB via the node IP.
| Field | Type | Description |
|---|---|---|
.spec.config.networkMode | string: host or container, optional, default host | In container mode, the operator creates a LoadBalancer Service and uses its address as the ALB address. |
.spec.address | string,required | you could manually specify the address of alb |
.spec.config.vip.enableLbSvc | bool, optional | Automatically true in container mode. |
.spec.config.vip.lbSvcAnnotations | map[string]string, optional | Extra annotations for the LoadBalancer Service. |
| Field | Type |
|---|---|
.spec.config.projects | []string,required |
.spec.config.portProjects | string,optional |
.spec.config.enablePortProject | bool,optional |
Adding an ALB to a project means:
If you enable port project and assign a port range to a project, this means:
there are some global config which can be tweaked in alb cr.
Some common configuration is exposed in the web UI. Follow these steps to create a load balancer:
Each input item in the web UI corresponds to a field of the CR:
| Parameter | Description |
|---|---|
| Assigned Address | .spec.address |
| Allocated By | Instance means project mode, and you could select project below, port means port-project mode, you could assign port-range after create alb |
Updating the load balancer will cause a service interruption for 3 to 5 minutes. Please choose an appropriate time for this operation!
Enter Administrator.
In the left navigation bar, click Network Management > Load Balancer.
Click ⋮ > Update.
Update the network and resource configuration as needed.
Please set specifications reasonably according to business needs. You can also refer to the relevant How to properly allocate CPU and memory resources for guidance.
Internal routing only supports updating from Disabled state to Enabled state.
Click Update.
After deleting the load balancer, the associated ports and rules will also be deleted and cannot be restored.
Enter Administrator.
In the left navigation bar, click Network Management > Load Balancer.
Click ⋮ > Delete, and confirm.
Frontend is a custom resource that defines the listener port and protocol for an ALB. Supported protocols: L7 (http|https|grpc|grpcs) and L4 (tcp|udp).
If you need to add an HTTPS listener port, you should also contact the administrator to assign a TLS certificate to the current project for encryption.
Create a ALB first.
alb label: Required, indicate the ALB instance to which this Frontend belongs to.
frontend name: Format as $alb_name-$port.
port: which port which listen on.
protocol: what protocol this port uses.
certificate_name: for grpcs and https protocol which the default cert used, Format as $secret_ns/$secret_name.
backendProtocol: what protocol the backend service uses.
Default serviceGroup:
serviceGroup.
Go to Container Platform.
In the left navigation bar, click Network > Load Balancing.
Click the name of the load balancer to enter the details page.
Click Add Port.
Each input item on the web UI corresponds to a field of the CR
| Parameter | Description |
|---|---|
| Session Affinity | .spec.serviceGroup.session_affinity_policy |
For traffic from HTTP, gRPC, and HTTPS ports, in addition to the default internal routing group, you can set more varied back-end service matching rules. The load balancer will initially match the corresponding backend service according to the set rules; if the rule match fails, it will then match the backend services corresponding to the aforementioned internal routing group.
You can click the ⋮ icon on the right side of the list page or click Actions in the upper right corner of the details page to update the default route or delete the listener port as needed.
If the resource allocation method of the load balancer is Port, only administrators can delete the related listener ports in the Administrator view.
Rule is a Custom Resource(CR) that defines how incoming requests are matched and processed by the ALB.
Ingresses handled by ALB can be auto-translated to rules.
Here is a demo rule to give you a quick first impression of how to use rules.
rule must be attached to a frontend and alb via label.
Frontend to which this rule belongs.DSLX is a domain-specific language used to describe the matching criteria. For example, the rule below matches a request that satisfies all the following criteria:
Priority is an integer ranging from 0 to 10, where lower values indicate higher priority. To configure the priority of a rule in ingress, you can use the following annotation format:
For rules, simply set the priority directly in .spec.priority using an integer value.
After a request matches a rule, you can apply the following actions to the request
| Feature | Description | Link |
|---|---|---|
| Timeout | Configures the timeout settings for requests. | timeout |
| Redirect | Redirects incoming requests to a specified URL. | redirect |
| CORS | Enables Cross-Origin Resource Sharing (CORS) for the application. | cors |
| Header Modification | Allows modification of request or response headers. | header modification |
| URL Rewrite | Rewrites the URL of incoming requests before forwarding them. | url-rewrite |
| WAF | Integrates Web Application Firewall (WAF) for enhanced security. | waf |
| OTEL | Enables OpenTelemetry (OTEL) for distributed tracing and monitoring. | otel |
| Keepalive | Enables or disables the keepalive feature for the application. | keepalive |
By default, the backend protocol is set to HTTP. If you want to use TLS re-encryption, you can configure it as HTTPS.
You can configure one or more services within a rule.
By default, the ALB uses a round-robin (RR) algorithm to distribute requests among backend services. However, you can assign weights to individual services or choose a different load-balancing algorithm.
For more details, refer to Balance Algorithm.

Each input item on the webui corresponds to a field of the CR
If the frontend protocol (ft) is HTTPS or GRPCS, the rule can also be configured to use HTTPS.
You can specify the certificate either in the rule or in the ingress to match the certificate for that specific port.
Termination is supported, and re-encryption is possible if the backend protocol is HTTPS. However, you cannot specify a certificate for communication with the backend service.
Certificates can be referenced across namespaces via annotation.
In .spec.certificate_name, the format is $secret_namespace/$secret_name
In edge mode, the client communicates with the ALB using HTTPS, and ALB communicates with backend services using HTTP protocol. To achieve this:
.spec.certificate_nameIn re-encrypt mode, the client communicates with the ALB using HTTPS, and ALB communicates with backend services using HTTPS protocol. To achieve this:
.spec.certificate_nameEach ALB creates an IngressClass with the same name and handles ingresses within the same project.
When an ingress namespace has a label like cpaas.io/project: demo, it indicates that the ingress belongs to the demo project.
ALBs that have the project name demo in their .spec.config.projects configuration will automatically translate these ingresses into rules.
ALB listens to ingress and automatically creates a Frontend or Rule. source field is defined as follows:
spec.source.type currently only supports ingress.spec.source.name is ingress name.spec.source.namespace is ingress namespace.For ingresses that do not have certificates configured, ALB provides a strategy to use a default certificate.
You can configure the ALB custom resource with the following settings:
.spec.config.defaultSSLStrategy: Defines the SSL strategy for ingresses without certificates.spec.config.defaultSSLCert: Sets the default certificate in the format $secret_ns/$secret_nameAvailable SSL strategies:
By combining logs and monitoring data, you can quickly identify and resolve load balancer issues.
Go to Administrator.
In the left navigation bar, click on Network Management > Load Balancer.
Click on Load Balancer Name.
In the Logs tab, view the logs of the load balancer's runtime from the container's perspective.
The cluster where the load balancer is located must deploy monitoring services.
Go to Administrator.
In the left navigation bar, click on Network Management > Load Balancer.
Click on Load Balancer Name.
In the Monitoring tab, view the metric trend information of the load balancer from the node's perspective.
Usage Rate: The real-time usage of CPU and memory by the load balancer on the current node.
Throughput: The overall incoming and outgoing traffic of the load balancer instance.
For more detailed information about monitoring metrics please refer to ALB Monitoring.