You can configure an AlbConfig resource to customize the settings of an Application Load Balancer (ALB) instance. This topic describes the annotations and AlbConfig fields that ALB Ingress supports and explains their usage.
Index
Annotation fields
Feature classification | Ingress annotation |
Annotation YAML | |
ALB Ingress configuration | |
Listener/Protocol configuration | |
Forwarding rule configuration | |
Advanced Configuration | |
Others |
AlbConfig fields
Field category | Field link |
AlbConfig YAML | |
AlbConfig | |
ALB instance | |
Listener configuration | |
Virtual switch | |
Simple Log Service | |
QUIC listener | |
Configure certificate | |
Access control | |
Tracing Analysis | |
X-Forwarded-For configuration | |
Use custom headers for logs | |
Reserved fields |
Annotation YAML example
The following code provides an example of how to use annotations to configure an ALB instance in an Ingress resource. For more information about the annotations, see the following sections.
Supported Ingress annotations
When you use ALB Ingress, you can add annotations to the Ingress resource as needed.
Health check
Annotation | Description |
alb.ingress.kubernetes.io/healthcheck-enabled | Specifies whether to enable health checks for the backend server group. For a health check configuration example, see Configure health checks.
Default value: |
alb.ingress.kubernetes.io/healthcheck-path | The path 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 HTTP version. This parameter is valid when
Default value: |
alb.ingress.kubernetes.io/healthcheck-method | The health check method.
Default value: Important If |
alb.ingress.kubernetes.io/healthcheck-httpcode | The health check status code. A backend server is considered healthy only if a probe is successful and returns the specified status code. You can specify one or more of the following options. Separate multiple status codes with commas (,).
Default value: |
alb.ingress.kubernetes.io/healthcheck-code | The health check status code. A backend server is considered healthy only if a probe is successful and returns the specified status code. If you use this field together with The valid values depend on the value of
|
alb.ingress.kubernetes.io/healthcheck-timeout-seconds | The timeout period for a health check. Unit: seconds (s). Valid values: 1 to 300. Default value: |
alb.ingress.kubernetes.io/healthcheck-interval-seconds | The interval for health checks. Unit: seconds (s). Valid values: 1 to 50. Default value: |
alb.ingress.kubernetes.io/healthy-threshold-count | The number of consecutive successful health checks required to declare a backend server healthy. Valid values: 2 to 10. Default value: |
alb.ingress.kubernetes.io/unhealthy-threshold-count | The number of consecutive failed health checks required to declare a backend server unhealthy. Valid values: 2 to 10. Default value: |
alb.ingress.kubernetes.io/healthcheck-connect-port | The port used for health checks. Default value: Note A value of |
Redirection
Annotation | Description |
alb.ingress.kubernetes.io/ssl-redirect | Specifies whether to return a 308 status code for HTTP requests and redirect them to the HTTPS listener on port 443. For a redirection configuration example, see Redirect HTTP requests to HTTPS.
Default value: |
Protocol used by the backend service
Annotation | Description |
alb.ingress.kubernetes.io/backend-protocol | The protocol used by the backend server group. For a configuration example, see Support for backend HTTPS and gRPC protocols.
Default value: Note The backend server group protocols supported by different listeners are as follows:
|
Rewrite
Annotation | Description |
alb.ingress.kubernetes.io/rewrite-target | The path to which requests are rewritten. For a rewrite configuration example, see Rewrite. |
Listener
Annotation | Description |
alb.ingress.kubernetes.io/listen-ports | The listener ports and protocols associated with the Ingress resource. For a configuration example, see Configure custom listener ports. You can specify the listener protocols and ports for the Ingress rules. The following code provides some examples:
|
Slow start
Annotation | Description |
alb.ingress.kubernetes.io/slow-start-enabled | Specifies whether to enable the slow start feature. If you enable slow start, ALB Ingress gradually distributes traffic to a new pod after it is added to the backend of a service. This prevents exceptions caused by high CPU and memory usage when the pod starts. For a slow start configuration example, see Backend slow start.
By default, this feature is disabled. |
alb.ingress.kubernetes.io/slow-start-duration | The duration of the slow start. The longer the duration, the slower the traffic increases. Unit: seconds (s). Valid values: 30 to 900. Default value: |
Priority
Annotation | Description |
alb.ingress.kubernetes.io/order | The relative priority of the forwarding rule. A smaller value indicates a higher priority. For a priority configuration example, see Configure forwarding rule priorities. Valid values: 1 to 1000. Default value: |
Grayscale
Annotation | Description |
alb.ingress.kubernetes.io/canary | Specifies whether to enable canary release. For more information about how to perform a canary release, see Implement canary releases using ALB Ingress.
Default value: |
alb.ingress.kubernetes.io/canary-by-header | The request header that is matched when canary release is enabled. |
alb.ingress.kubernetes.io/canary-by-header-value | The value of the request header that is matched when canary release is enabled. |
alb.ingress.kubernetes.io/canary-by-cookie | The cookie that is matched when canary release is enabled. |
alb.ingress.kubernetes.io/canary-weight | The percentage of requests that are forwarded to the specified service. The value must be an integer from 0 to 100. For more information, see Canary release by weight. |
Session persistence
Annotation | Description |
alb.ingress.kubernetes.io/sticky-session | Specifies whether to enable session persistence for the backend server group. For a session persistence configuration example, see Enable session persistence using annotations.
Default value: |
alb.ingress.kubernetes.io/sticky-session-type | The type of session persistence.
Default value: |
alb.ingress.kubernetes.io/cookie-timeout | The session persistence timeout. Unit: seconds (s). Valid values: 1 to 86400. Default value: |
alb.ingress.kubernetes.io/cookie | The custom cookie value. Type: string. Default value: |
Connection draining
Annotation | Description |
alb.ingress.kubernetes.io/connection-drain-enabled | Specifies whether to enable connection draining. If you enable connection draining, ALB Ingress maintains normal traffic forwarding for a period of time when a backend pod enters the Terminating state or is reported as abnormal by a health check. The connection is terminated after the timeout period is reached. This prevents service interruptions caused by the sudden removal of a backend. For more information about how connection draining works, see Connection draining.
By default, this feature is disabled. |
alb.ingress.kubernetes.io/connection-drain-timeout | The connection draining timeout. Unit: seconds (s). Valid values: 0 to 900. Default value: |
Load balancing
Annotation | Description |
alb.ingress.kubernetes.io/backend-scheduler | The load balancing algorithm for the backend server group. For a load balancing algorithm configuration example, see Specify a load balancing algorithm for a server group.
Default value: |
alb.ingress.kubernetes.io/backend-scheduler-uch-value | The URL hash parameter used when the load balancing algorithm is "uch". |
Cross-domain
Annotation | Description |
alb.ingress.kubernetes.io/enable-cors | Specifies whether to enable cross-domain configuration. For a configuration example, see Cross-domain configuration.
Default value: |
alb.ingress.kubernetes.io/cors-allow-origin | The allowed cross-domain origins. Default value: |
alb.ingress.kubernetes.io/cors-expose-headers | The list of headers that can be exposed. |
alb.ingress.kubernetes.io/cors-allow-methods | The allowed cross-domain request methods. You can specify one or more of the following options:
Default value: |
alb.ingress.kubernetes.io/cors-allow-credentials | Specifies whether cross-domain requests can carry credential information.
Default value: |
alb.ingress.kubernetes.io/cors-max-age | The maximum cache time for preflight requests in the browser. Unit: seconds (s). Valid values: -1 to 172800. Default value: Note A value of |
alb.ingress.kubernetes.io/cors-allow-headers | The list of allowed cross-domain headers. Default value: |
Custom forwarding
Annotation | Description |
alb.ingress.kubernetes.io/actions.{svcName} | The custom forwarding action. For more information about custom forwarding, see Customize forwarding rules for ALB Ingresses. |
alb.ingress.kubernetes.io/conditions.{svcName} | The custom forwarding condition. |
alb.ingress.kubernetes.io/rule-direction.{svcName} | The custom forwarding direction.
Default value: |
IPv6 support for server groups
Annotation | Description |
alb.ingress.kubernetes.io/enable-ipv6 | Specifies whether to enable IPv6 for the server group. For a configuration example, see IPv6 support for server groups.
Default value: |
Others
Annotation | Description |
alb.ingress.kubernetes.io/backend-keepalive | Specifies whether to enable persistent connections to backend servers. For a configuration example, see Backend persistent connections. Default value: |
alb.ingress.kubernetes.io/traffic-limit-qps | The queries per second (QPS) throttling configuration. Valid values: 1 to 1000000. |
alb.ingress.kubernetes.io/use-regex | Allows the Path field to use regular expressions. This is valid only for the Prefix type. Default value: |
AlbConfig fields
AlbConfig is a CustomResourceDefinition (CRD) that describes an ALB instance and its listeners. The following code provides a full AlbConfig example. For more information about the fields, see the following sections.
Albconfig
Field | Type | Description |
apiVersion | Fixed value | The versioned schema of this object. Fixed value: |
kind | Fixed value | The REST resource that this object represents. Fixed value: |
metadata | Standard object metadata. For more information, see metadata. | |
spec | A list of parameters that describe the properties of the ALB instance and its listeners. | |
status | After a successful reconciliation, the instance status is written to the |
AlbConfigSpec
Field | Type | Description |
config | The properties of the ALB instance. | |
listeners | The listener properties of the instance. |
LoadBalancerSpec
Field | Type | Description |
id | string | The ID of the ALB instance. Specify an ID to reuse an existing instance. If you leave this field empty, the controller creates an ALB instance. For more information about how to create a new ALB instance or reuse an existing one, see Create an AlbConfig. Default value: |
name | string | The name of the ALB instance. Default value: automatically generated based on the following rule: |
addressAllocatedMode | enum | The address mode of the ALB instance.
Default value: |
addressType | enum | The IPv4 address type of the ALB instance.
Default value: |
ipv6AddressType | enum | The IPv6 address type of the ALB instance. This does not need to be the same as the IPv4 address type.
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 instance belongs. Default value: |
edition | enum | The edition of the instance. You cannot change the edition of a reused instance.
Default value: |
deletionProtectionEnabled | bool | This is a reserved field. Do not modify it. |
forceOverride | bool | Specifies whether to forcibly overwrite the instance properties in reuse mode.
Default value: |
listenerForceOverride | bool | Specifies whether to forcibly overwrite the listener properties in reuse mode.
Default value: |
zoneMappings | The zone and EIP configurations. | |
accessLogConfig | Log collection. | |
billingConfig | Billing method. | |
modificationProtectionConfig | Configuration read-only mode. | |
tags | The tags of the instance. | |
securityGroupIds | string[] | The IDs of the security groups to which the ALB instance is added. For more information, see Configure a security group using an AlbConfig. |
ZoneMapping
Field | Type | Description |
vSwitchId | string | (Required) The ID of the virtual switch. Default value: |
zoneId | string | The zone of the virtual switch. Keep the default value. Default value: |
allocationId | string | The ID of the elastic IP address (EIP). For a configuration example, see Configure an ALB instance using an AlbConfig. Default value: |
eipType | string | This is a reserved field. Do not modify it. |
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. The name must start with Default value: |
BillingConfig
Field | Type | Description |
internetBandwidth | int | This is a reserved field. Do not modify it. |
internetChargeType | string | This is a reserved field. Do not modify it. |
payType | enum | This is a reserved field. Do not modify it. |
bandWidthPackageId | string | The ID of the Internet Shared Bandwidth instance to attach. You cannot detach the instance after it is attached. For a configuration example, see Internet Shared Bandwidth configuration. Default value: |
ModificationProtectionConfig
Field | Type | Description |
reason | string | Reserved field. |
status | string | Reserved field. |
Tag
Field | Type | Description |
key | string | The key of the tag. Default value: |
value | string | The value of the tag. Default value: |
ListenerSpec
Field | Type | Description |
gzipEnabled | bool | Specifies whether to enable data compression. For a data compression configuration example, see Use data compression.
Default value: |
http2Enabled | bool | Specifies whether to enable HTTP/2.
Default value: |
port | int | (Required) The port used by the listener. Default value: |
protocol | enum | (Required) The protocol used by the listener.
|
securityPolicyId | string | The ID of the TLS security policy. Default value: |
idleTimeout | int | The idle connection timeout. Unit: seconds (s). Valid values: 1 to 600. Default value: Note A value of 0 indicates that the default value is used. |
loadBalancerId | string | This is a reserved field. Do not modify it. |
description | string | The name of the listener. Default value: automatically generated based on the following rule: |
caEnabled | bool | Specifies whether to enable mutual authentication.
Default value: |
requestTimeout | int | The request timeout. Unit: seconds (s). Valid values: 1 to 600. Default value: |
quicConfig | QUIC listener configuration. | |
defaultActions | Action[] | This is a reserved field. Do not modify it. |
caCertificates | The root CA certificate of the listener. | |
certificates | The server certificate of the listener. | |
xForwardedForConfig | X-Forwarded-For field configuration. | |
logConfig | Listener log configuration. | |
aclConfig | Access control. |
QuicConfig
Field | Type | Description |
quicUpgradeEnabled | bool | Specifies whether to enable QUIC upgrade. In scenarios where QUIC and HTTPS listeners are used together, quicUpgradeEnabled is used to associate or disassociate the QUIC and HTTPS listeners. For more information, see Use a QUIC listener to support HTTP/3.
Default value: |
quicListenerId | string | The HTTPS listener associated with the QUIC listener. Default value: |
Certificate
Field | Type | Description |
IsDefault | bool | Specifies whether the certificate is the default certificate. For more information about how to configure a certificate, see Configure an HTTPS certificate to enable encrypted communication.
Default value: Important You can specify only one certificate as the default certificate. |
CertificateId | string | The CertIdentifier 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 a value, the This field is valid only when Default value: |
XForwardedForClientCertClientVerifyAlias | string | A custom field name. After you specify a value, the This field is valid only when Default value: |
XForwardedForClientCertIssuerDNAlias | string | A custom field name. After you specify a value, the This field is valid only when Default value: |
XForwardedForClientCertFingerprintAlias | string | A custom field name. After you specify a value, the This field is valid only when Default value: |
XForwardedForClientSourceIpsEnabled | bool | Specifies whether to allow ALB to retrieve the originating IP address of the client from the
Default value: |
XForwardedForClientSourceIpsTrusted | string | Specifies the trusted proxy IP addresses. Enter a valid IP address or CIDR block. Separate multiple values with semicolons (
Example: |
AclConfig
Field | Type | Description |
aclName | string | The name of the associated access control list (ACL) policy in AclEntry mode. For more information about how to configure an ACL, see Configure an ACL for access control. Default value: |
aclType | enum | The access control mode.
|
aclEntries | string | The ACL entries. Default value: Important The |
aclIds | string | A list of existing policy IDs to associate. Default value: |
LogConfig
Field | Type | Description |
accessLogRecordCustomizedHeadersEnabled | bool | Specifies whether to use custom headers in the access logs of the ALB instance.
Default value: |
accessLogTracingConfig | Parameters for Tracing Analysis. For more information about how to use Tracing Analysis, see Enable Xtrace for Tracing Analysis using an AlbConfig. |
AccessLogTracingConfig
Field | Type | Description |
tracingEnabled | bool | Specifies whether to enable Tracing Analysis.
Default value: |
tracingSample | int | The sample rate for Tracing Analysis. The unit is Valid values: 1 to 10000. |
tracingType | enum | The sampling algorithm for Tracing Analysis.
|
AlbConfigStatus
The following fields, AlbConfigStatus, LoadBalancerStatus, ListenerStatus, and AppliedCertificate, are reserved fields. They are used by ALB Ingress to automatically record status information. Do not modify them.
Field | Output | Description |
loadBalancer | This is a reserved field. Do not modify it. The status of the ALB instance. |
LoadBalancerStatus
Field | Output | Description |
dnsname | string | This is a reserved field. Do not modify it. The DNS name of the ALB instance. |
id | string | This is a reserved field. Do not modify it. The ID of the ALB instance. |
listeners | This is a reserved field. Do not modify it. The listener properties of the ALB instance. |
ListenerStatus
Field | Output | Description |
portAndProtocol | string | This is a reserved field. Do not modify it. The port and protocol used by the listener. |
certificates | This is a reserved field. Do not modify it. The certificate that is associated with the listener. |
AppliedCertificate
Field | Output | Description |
certificateId | string | This is a reserved field. Do not modify it. The CertIdentifier of the certificate. |
isDefault | bool | This is a reserved field. Do not modify it. Specifies whether the certificate is the default certificate. |
References
For information about the specific settings in AlbConfig, see Configure an ALB instance using an AlbConfig.
For information about how to use ALB Ingress annotations, see Advanced usage of ALB Ingress.