You can use an AlbConfig to define the configuration of an Application Load Balancer (ALB) instance. This topic describes the annotations that are supported by ALB Ingresses. This topic also introduces the AlbConfig fields and how these fields are used.
Annotations supported by ALB Ingresses
You can add annotations to ALB Ingresses based on your business requirements.
Health checks
Annotation | Description |
alb.ingress.kubernetes.io/healthcheck-enabled | Specifies whether to enable the health check feature for backend server groups. For more information, see Configure health checks.
Default value: |
alb.ingress.kubernetes.io/healthcheck-path | The URL that is used for health checks. Default value: |
alb.ingress.kubernetes.io/healthcheck-protocol | The protocol for health checks.
Default value: |
alb.ingress.kubernetes.io/healthcheck-httpversion | The version of the HTTP protocol. This parameter takes effect only when the
Default value: |
alb.ingress.kubernetes.io/healthcheck-method | The health check method.
Default value: Important If you set |
alb.ingress.kubernetes.io/healthcheck-httpcode | The status codes returned for health checks. A backend server is considered healthy only when the health check request is successful and one of the specified status codes is returned. You can select one or more of the following status codes, and separate multiple status codes with commas (,):
Default value: |
alb.ingress.kubernetes.io/healthcheck-code | The status codes returned for health checks. A backend server is considered healthy only when the health check request is successful and one of the specified status codes is returned. If you specify both this parameter and Values for this parameter depend on the value specified in
|
alb.ingress.kubernetes.io/healthcheck-timeout-seconds | The health check timeout period in seconds. Valid values: 1 to 300. Default value: |
alb.ingress.kubernetes.io/healthcheck-interval-seconds | The health check interval in seconds. Valid values: 1 to 50. Default value: |
alb.ingress.kubernetes.io/healthy-threshold-count | The number of times that a server must consecutively pass health checks before it is considered healthy. Valid values: 2 to 10. Default value: |
alb.ingress.kubernetes.io/unhealthy-threshold-count | The number of times that a server must consecutively fail health checks before it is considered unhealthy. Valid values: 2 to 10. Default value: |
alb.ingress.kubernetes.io/healthcheck-connect-port | The port that is used for health checks. Default value: Note The value |
Redirects
Annotation | Description |
alb.ingress.kubernetes.io/ssl-redirect | Specifies whether to return a status code of 308 for HTTP requests and redirect them to HTTPS listeners on port 443. For more information about how to configure a redirection, see Redirect HTTP requests to HTTPS.
Default value: |
Backend server protocol
Annotation | Description |
alb.ingress.kubernetes.io/backend-protocol | The protocol used by backend server groups. For more information, Configure the HTTPS or gRPC protocol.
Default value: Note The backend server protocols supported by listeners depend on the listener type:
|
Rewrites
Annotation | Description |
alb.ingress.kubernetes.io/rewrite-target | The path that overwrites the path in requests. For more information, see Configure rewrite rules. |
Listeners
Annotation | Description |
alb.ingress.kubernetes.io/listen-ports | The listening ports and protocols of listeners associated with an ALB Ingress. For more information, see Configure custom listening ports. Examples:
|
Slow start
Annotation | Description |
alb.ingress.kubernetes.io/slow-start-enabled | Specifies whether to enable the slow start mode. After you enable slow start mode, the ALB Ingress gradually distributes traffic to new pods added to the Service backend to avoid sudden CPU and memory spikes caused by the startup of the pods. For more information about slow start configurations, see Backend slow start.
By default, this mode is disabled. |
alb.ingress.kubernetes.io/slow-start-duration | The time taken for the slow start to gradually increase traffic. The longer the duration, the slower the increase in traffic. Unit: seconds. Valid values: 30 to 900. Default value: |
Priorities
Annotation | Description |
alb.ingress.kubernetes.io/order | The priority of a forwarding rule. A smaller value indicates a higher priority. For more information, see Configure forwarding rule priorities. Valid values: 1 to 1000. Default value: |
Canary
Annotation | Description |
alb.ingress.kubernetes.io/canary | Specifies whether to route requests to the canary. For more information, see Use annotations to perform canary releases.
Default value: |
alb.ingress.kubernetes.io/canary-by-header | The header of the requests that are routed to the canary. |
alb.ingress.kubernetes.io/canary-by-header-value | The value of the header of the requests that are routed to the canary. |
alb.ingress.kubernetes.io/canary-by-cookie | The cookie of the requests that are routed to the canary. |
Session persistence
Annotation | Description |
alb.ingress.kubernetes.io/sticky-session | Specifies whether to enable session persistence. For more information, see Configure session persistence by using annotations.
Default value: |
alb.ingress.kubernetes.io/sticky-session-type | The method that is used to handle cookies.
Default value: |
alb.ingress.kubernetes.io/cookie-timeout | The session persistence timeout period in seconds. Valid values: 1 to 86400. Default value: |
Connection draining
Annotation | Description |
alb.ingress.kubernetes.io/connection-drain-enabled | Specifies whether to enable connection draining. If connection draining is enabled, the ALB Ingress maintains normal traffic for a certain period when the backend pods enter the Terminating state or when the health check fails. Connections are terminated only after the timeout period is reached, which helps mitigate the impact on services caused by sudden removal of the backend. For more information about how connection draining works, see Connection draining.
Default value: |
alb.ingress.kubernetes.io/connection-drain-timeout | The timeout period of connection draining. Unit: seconds. Valid values: 0 to 900. Default value: |
Load balancing
Annotation | Description |
alb.ingress.kubernetes.io/backend-scheduler | The load balancing algorithm of backend server groups. For more information, see Specify a load balancing algorithm for backend server groups.
Default value: |
alb.ingress.kubernetes.io/backend-scheduler-uch-value | The URL hashing parameter that is available when the load balancing algorithm is uch. |
Cross-origin resource sharing (CORS)
Annotation | Description |
alb.ingress.kubernetes.io/enable-cors | Specifies whether to enable CORS. For more information, see Configure CORS.
Default value: |
alb.ingress.kubernetes.io/cors-allow-origin | The origins from which you want to allow cross-domain requests. Default value: |
alb.ingress.kubernetes.io/cors-expose-headers | The headers that can be exposed. |
alb.ingress.kubernetes.io/cors-allow-methods | The methods of cross-domain requests that are allowed. You can select one or more of the following methods:
Default value: |
alb.ingress.kubernetes.io/cors-allow-credentials | Specifies whether to carry credentials in requests.
Default value: |
alb.ingress.kubernetes.io/cors-max-age | The maximum cache time of preflight requests in the browser. Unit: seconds. Valid values: -1 to 172800. Default value: Note
|
alb.ingress.kubernetes.io/cors-allow-headers | The headers of cross-domain requests that are allowed. Default value: |
Custom forwarding
Annotation | Description |
alb.ingress.kubernetes.io/actions.{svcName} | The custom forwarding actions. For more information, see Customize the routing rules of an ALB Ingress. |
alb.ingress.kubernetes.io/conditions.{svcName} | The custom forwarding conditions. |
alb.ingress.kubernetes.io/rule-direction.{svcName} | The custom forwarding direction.
Default value: |
Others
Annotation | Description |
alb.ingress.kubernetes.io/backend-keepalive | Specifies whether to enable persistent TCP connections. For more information, see Configure persistent TCP connections. Default value: |
alb.ingress.kubernetes.io/traffic-limit-qps | QPS throttling. Valid values: 1 to 100000. |
alb.ingress.kubernetes.io/use-regex | Specifies whether regular expressions can be used in the Path field. This annotation is valid only when the path type is Prefix. Default value: |
AlbConfig fields
An AlbConfig is a CustomResourceDefinition (CRD) used to describe an ALB instance and its listeners. The following tables describe the relevant fields.
Albconfig
Field | Type | Description |
apiVersion | Fixed value | The API version of the object. Set the value to |
kind | Fixed value | Kind indicates the REST resource corresponding to the object. Set the value to |
metadata | The metadata of the object. For more information, see metadata. | |
spec | A list of parameters used to describe the attributes of the ALB instance and its listeners. | |
status | The state of the ALB instance is written into the |
AlbConfigSpec
Field | Type | Description |
config | The attributes of the ALB instance. | |
listeners | The attributes of the listeners of the ALB instance. |
LoadBalancerSpec
Field | Type | Description |
id | string | The ID of the ALB instance. The ALB instance can be reused if an instance ID is specified. If you leave this field empty, the ALB Ingress controller creates an ALB instance. For more information about how to create or reuse an ALB instance, see Create an AlbConfig. Default value: |
name | string | The name of the ALB instance. Default value: A name in the |
addressAllocatedMode | enum | The IP mode of the ALB instance.
Default value: |
addressType | enum | The network type of the IPv4 CIDR block of the ALB instance.
Default value: |
ipv6AddressType | enum | The network type of the IPv6 CIDR block of the ALB instance. The network type can be different from that of the IPv4 CIDR block of the ALB instance.
Default value: |
addressIpVersion | enum | Specifies whether the ALB instance supports dual stack.
Default value: |
resourceGroupId | string | The ID of the resource group to which the ALB instance belongs. Default value: |
edition | enum | The edition of the ALB instance. You cannot modify this parameter in reuse mode.
Default value: |
deletionProtectionEnabled | bool | A reserved field. Do not modify this field. |
forceOverride | bool | Specifies whether to forcefully overwrite the attributes of the ALB instance in reuse mode.
Default value: |
listenerForceOverride | bool | Specifies whether to forcefully overwrite the attributes of the listeners in reuse mode.
Default value: |
zoneMappings | The zone and elastic IP address (EIP) configuration. | |
accessLogConfig | The log collection configuration. | |
billingConfig | The billing method. | |
modificationProtectionConfig | The configuration protection setting. | |
tags | The labels of the ALB instance. |
ZoneMapping
Field | Type | Description |
vSwitchId | string | The vSwitch ID. This field is required. Default value: |
zoneId | string | The zone of the vSwitch. Default value: |
allocationId | string | The ID of the EIP. Default value: |
eipType | string | A reserved field. Do not modify this field. |
AccessLogConfig
Field | Type | Description |
logProject | string | The name of the Simple Log Service (SLS) project. Default value: |
logStore | string | The name of the SLS Logstore, which must start with Default value: |
BillingConfig
Field | Type | Description |
internetBandwidth | int | A reserved field. Do not modify this field. |
internetChargeType | string | A reserved field. Do not modify this field. |
payType | enum | A reserved field. Do not modify this field. |
bandWidthPackageId | string[] | The ID of the associated Internet Shared Bandwidth instance. You cannot disassociate the Internet Shared Bandwidth instance. Default value: |
ModificationProtectionConfig
Field | Type | Description |
reason | string | A reserved field. |
status | string | A reserved field. |
Tag
Field | Type | Description |
key | string | The key of the label. Default value: |
value | string | The value of the label. Default value: |
ListenerSpec
Field | Type | Description |
gzipEnabled | bool | Specifies whether to enable data compression. For more information, see Configure data compression.
Default value: |
http2Enabled | bool | Specifies whether to enable HTTP/2.
Default value: |
port | int | The listening port. This field is required. Default value: |
protocol | enum | The listening protocol. This field is required.
|
securityPolicyId | string | The ID of the TLS security policy. Default value: |
idleTimeout | int | The timeout period of idle connections in seconds. Default value: Note A value of 0 indicates that the default value is used. |
loadBalancerId | string | A reserved field. Do not modify this field. |
description | string | The name of the listener. By default, a name in the |
caEnabled | bool | Specifies whether to enable mutual authentication.
Default value: |
requestTimeout | int | The timeout period of requests in seconds. Default value: |
quicConfig | The QUICK listener configuration. | |
defaultActions | Action[] | A reserved field. Do not modify this field. |
caCertificates | The root CA certificate of the listener. | |
certificates | The server certificate of the listener. | |
xForwardedForConfig | The configuration of the XForward header. | |
logConfig | The listener log configuration. | |
aclConfig | The access control configuration. |
QuicConfig
Field | Type | Description |
quicUpgradeEnabled | bool | Specifies whether to enable QUIC upgrade. In scenarios where both QUIC and HTTPS listeners are used, set the quicUpgradeEnabled field to associate QUIC listeners with HTTPS listeners or disassociate QUIC listeners from HTTPS listeners. For more information, see Use QUIC Listener to Support HTTP/3 Protocol.
Default value: |
quicListenerId | string | HTTPS listeners associated with the QUIC listeners. Default value: |
Certificate
Field | Type | Description |
IsDefault | bool | Specifies whether the certificate is a default certificate. For more information, see Configure HTTPS Certificates for Encrypted Communication.
Default value: Important You can specify only one default certificate. |
CertificateId | string | The ID of the certificate. Default value: |
XForwardedForConfig
Field | Type | Description |
XForwardedForClientCertSubjectDNEnabled | bool | Specifies whether to add the
Default value: |
XForwardedForProtoEnabled | bool | Specifies whether to add the
Default value: |
XForwardedForClientCertIssuerDNEnabled | bool | Specifies whether to add the
Default value: |
XForwardedForSLBIdEnabled | bool | Specifies whether to add the
Default value: |
XForwardedForClientSrcPortEnabled | bool | Specifies whether to add the
Default value: |
XForwardedForClientCertFingerprintEnabled | bool | Specifies whether to add the
Default value: |
XForwardedForEnabled | bool | Specifies whether to add the |
XForwardedForSLBPortEnabled | bool | Specifies whether to add the
Default value: |
XForwardedForClientCertClientVerifyEnabled | bool | Specifies whether to add the
Default value: |
XForwardedForClientCertSubjectDNAlias | string | A custom field name. After you specify this field, the name of the This field takes effect only when Default value: |
XForwardedForClientCertClientVerifyAlias | string | A custom field name. After you specify this field, the name of the This field takes effect only when Default value: |
XForwardedForClientCertIssuerDNAlias | string | A custom field name. After you specify this field, the name of the This field takes effect only when Default value: |
XForwardedForClientCertFingerprintAlias | string | A custom field name. After you specify this field, the name of the This field takes effect only when Default value: |
XForwardedForClientSourceIpsEnabled | bool | Specifies whether to allow the ALB instance to retrieve client IP addresses from the
Default value: |
XForwardedForClientSourceIpsTrusted | string | Specify a trusted proxy IP address. Enter a valid IP address or CIDR block. Separate multiple values by semicolons (
Sample Value: |
AclConfig
Field | Type | Description |
aclName | string | The name of the network ACL in AclEntry mode. For more information, see Configure network ACLs. Default value: |
aclType | enum | The access control mode.
|
aclEntries | string[] | The network ACL rules. Default value: Important The |
aclIds | string[] | The list of the IDs of existing network ACLs. Default value: |
LogConfig
Field | Type | Description |
accessLogRecordCustomizedHeadersEnabled | bool | Specifies whether to record custom headers in the access log of the ALB instance.
Default value: |
accessLogTracingConfig | The Tracing Analysis configuration. For more information, see Use AlbConfigs to enable Tracing Analysis based on Xtrace. |
AccessLogTracingConfig
Field | Type | Description |
tracingEnabled | bool | Specifies whether to enable Tracing Analysis.
Default value: |
tracingSample | int | The sampling rate of Tracing Analysis. Unit: Valid values: 1 to 10000. |
tracingType | enum | The sampling algorithm of Tracing Analysis.
|
AlbConfigStatus
The AlbConfigStatus
, LoadBalancerStatus
, ListenerStatus
, and AppliedCertificate
fields are reserved fields used by ALB Ingresses to record states. Do not modify these fields.
Field | Output | Description |
loadBalancer | A reserved field. Do not modify this field. The status of the ALB instance. |
LoadBalancerStatus
Field | Output | Description |
dnsname | string | A reserved field. Do not modify this field. The DNS address of the ALB instance. |
id | string | A reserved field. Do not modify this field. The ID of the ALB instance. |
listeners | A reserved field. Do not modify this field. The listener attributes of the ALB instance. |
ListenerStatus
Field | Output | Description |
portAndProtocol | string | A reserved field. Do not modify this field. The ports and protocols used by listeners. |
certificates | A reserved field. Do not modify this field. The certificates associated with listeners. |
AppliedCertificate
Field | Output | Description |
certificateId | string | A reserved field. Do not modify this field. The ID of the certificate. |
isDefault | bool | A reserved field. Do not modify this field. Specifies whether the certificate is a default certificate. |
References
For more information about the parameters in an AlbConfig, see Use an AlbConfig to configure an ALB instance.
For more information about how to use ALB Ingress annotations, see Advanced ALB Ingress configurations.