ALB Ingress operations guide

Updated at:
Copy as MD

In addition to Container Service for Kubernetes (ACK) and ACK Serverless, ALB Ingress works with Enterprise Distributed Application Service (EDAS), Serverless App Engine (SAE), and self-managed Kubernetes clusters to support diverse business requirements. This topic describes the basic and advanced features of ALB Ingress and shows how to use it with other Alibaba Cloud services.

Basic features

An AlbConfig is a Custom Resource Definition (CRD) provided by the ALB Ingress controller for configuring Application Load Balancer (ALB) instances and listeners. The following table describes how to install and uninstall the ALB Ingress controller, create and modify AlbConfigs, and enable Simple Log Service in ACK and ACK Serverless clusters.

Object

Feature

Description

ACK documentation

ACK Serverless documentation

ALB Ingress controller

Manage the ALB Ingress controller component

ACK provides a managed ALB Ingress controller based on ALB.

You can install the ALB Ingress controller when you create a cluster or on the Add-ons page.

Manage the ALB Ingress controller component

Manage the ALB Ingress controller component

Instance management

Create an AlbConfig

An AlbConfig is a Custom Resource Definition (CRD) provided by the ALB Ingress controller that you use to configure an ALB instance and its listeners.

Each AlbConfig corresponds to one ALB instance, so you must create multiple AlbConfigs to use multiple ALB instances.

Create an AlbConfig

Create an AlbConfig

Associate an Ingress

An AlbConfig is associated with an Ingress by using a standard Kubernetes IngressClass resource. You must first create an IngressClass and then associate it with the AlbConfig.

Create an IngressClass and associate it with an AlbConfig

Use an IngressClass to associate an AlbConfig with an Ingress

Modify an AlbConfig

You can modify AlbConfig properties, such as the name and vSwitch settings.

Changes take effect immediately after you save them.

Enable access logging with Simple Log Service

If you want ALB Ingress to collect access logs, you must specify logProject and logStore in the AlbConfig.

Note
  • You must manually create a Simple Log Service Project. For more information, see Manage projects.

  • The Logstore name must start with alb_. If the specified Logstore does not exist, the system automatically creates it.

Enable access logging with Simple Log Service

Enable access logging with Simple Log Service

Reuse an existing ALB instance

To reuse an existing ALB instance, specify its ID when creating the AlbConfig.

Reuse an existing ALB instance

Reuse an existing ALB instance

Use multiple ALB instances

When you need to use multiple ALB instances, you can specify different IngressClasses in the Ingress by using spec.ingressClassName.

Create and use multiple ALB instances

Create and use multiple ALB instances

Delete an ALB instance

Each ALB instance corresponds to one AlbConfig. To delete an ALB instance, delete its associated AlbConfig. Before deleting an AlbConfig, you must first delete all Ingresses associated with it.

Delete an AlbConfig

Delete an AlbConfig

Listener management

Specify an HTTPS certificate

You can specify an Application Load Balancer (ALB) certificate by using an ALBConfig and configuring its listeners to specify the certificate ID for HTTPS.

Configure an HTTPS certificate to enable encrypted communication

Configure an HTTPS certificate to enable encrypted communication

Support for TLS security policies

When configuring an HTTPS listener in an AlbConfig, you can specify a custom or system default TLS security policy. For more information, see TLS security policies.

Specify a TLS security policy

Specify a TLS security policy

Advanced features

In an ACK cluster, ALB Ingress manages external access to cluster Services, providing Layer 7 load balancing capabilities. The following table describes how to use an ALB Ingress to forward requests from different domain names or URL paths to different backend server groups, redirect HTTP requests to HTTPS, and implement canary releases.

Feature

Description

ACK documentation

ACK Serverless documentation

Forward requests based on domain names

Create a simple Ingress to forward requests based on a specified domain name or an empty domain name.

Forward requests based on domain names

Forward requests based on domain names

Forward requests based on URL paths

ALB Ingress supports request forwarding based on URL paths. You can specify a URL matching policy in the pathType field. pathType supports the following three match modes.

Forward requests based on URL paths

Forward requests based on URL paths

Custom forwarding rules

ALB Ingress supports custom forwarding rules composed of match conditions and actions. With ALB Ingress, you can:

  • You can define custom match conditions based on criteria such as the request's domain name, path, request header, query string, request method, Cookie, and source IP in the alb.ingress.kubernetes.io/conditions.<service-name> annotation.

  • To configure custom forwarding actions, such as fixed responses, redirects, request header insertions, traffic mirroring, forwarding to multiple backend server groups, and rewrites, you can use the alb.ingress.kubernetes.io/actions.<service-name> annotation.

  • Define custom match conditions, such as the domain name, path, and HTTP header in the ACK console.

  • Define custom actions, such as forwarding requests or returning a fixed response in the ACK console.

Important
  • A forwarding rule supports a maximum of 10 match conditions.

  • The ResponseHeader and ResponseStatusCode match conditions take effect only in custom response forwarding rules.

Customize forwarding rules for ALB Ingress

Customize forwarding rules for ALB Ingress

Configure health checks

You can use an annotation to configure health checks and ensure service availability.

Configure health checks

Configure health checks

Configure automatic certificate discovery

You must first create a certificate in the Certificate Management Service console. The ALB Ingress controller then automatically discovers and matches the certificate to the domain name specified in the Ingress's TLS configuration.

Configure an HTTPS certificate to enable encrypted communication

Configure an HTTPS certificate to enable encrypted communication

Redirect HTTP to HTTPS

To redirect HTTP requests to HTTPS port 443 with an ALB Ingress, use the following annotation.

Redirect HTTP to HTTPS

Redirect HTTP to HTTPS

Support for HTTPS and gRPC protocols

ALB supports HTTPS and gRPC as backend protocols. You can configure them for an ALB Ingress by setting the annotation to alb.ingress.kubernetes.io/backend-protocol: "grpc" or alb.ingress.kubernetes.io/backend-protocol: "https". To use an Ingress to forward requests to a gRPC Service, the corresponding domain name must have an SSL certificate and use the TLS protocol for communication.

Note

The backend protocol cannot be modified. If you need to change the protocol, delete and recreate the Ingress.

Support for backend HTTPS and gRPC protocols

Support for backend HTTPS and gRPC protocols

Support for rewrite

You can configure rewrites by setting the alb.ingress.kubernetes.io/rewrite-target: /path/${2} annotation.

Note
  • In the rewrite-target annotation, capture group variables of the ${number} type need to be configured on a path of the Prefix type.

  • The path parameter does not support regular expression symbols such as * and ? by default. To use them, you must configure the rewrite-target annotation.

  • The path must start with /.

Configure rewrites

Configure rewrites

Configure custom listener ports

ALB Ingress supports custom listener ports. This allows you to expose services on both port 80 and port 443 at the same time.

Configure custom listener ports

Configure custom listener ports

Configure forwarding rule priority

You can use an annotation to define the priority of forwarding rules for an ALB Ingress.

Note

Rule priorities must be unique within the same listener. The alb.ingress.kubernetes.io/order annotation specifies the priority order among Ingresses. The value ranges from 1 to 1000, and a smaller value indicates a higher priority.

Configure forwarding rule priority

Configure forwarding rule priority

Implement a canary release by using annotations

ALB Ingress provides complex routing capabilities and supports canary releases based on Header, Cookie, and weight. You can use annotations to implement canary releases. To enable this feature, set the alb.ingress.kubernetes.io/canary: "true" annotation. You can use different annotations to implement various types of canary releases.

Implement session persistence by using annotations

ALB Ingress supports session persistence through the alb.ingress.kubernetes.io/sticky-session and alb.ingress.kubernetes.io/sticky-session-type annotations.

Implement session persistence by using annotations

Implement session persistence by using annotations

Specify a load balancing algorithm for a server group

ALB Ingress supports specifying the server group load balancing algorithm by setting the Ingress annotation alb.ingress.kubernetes.io/backend-scheduler.

Specify a load balancing algorithm for a server group

Specify a load balancing algorithm for a server group

Configure cross-origin resource sharing (CORS)

You can configure cross-origin resource sharing (CORS) by using annotations.

Configure CORS

Configure CORS

Backend persistent connections

ALB supports backend keep-alive connections to reduce resource consumption at the connection layer and improve processing performance. In ALB Ingress, you can enable this feature by using the annotation alb.ingress.kubernetes.io/backend-keepalive.

Backend persistent connections

Backend persistent connections

Support for QPS throttling

ALB supports QPS throttling for forwarding rules. The QPS throttling value can range from 1 to 100,000. For ALB Ingress, you only need to set the alb.ingress.kubernetes.io/traffic-limit-qps annotation.

Support for QPS throttling

Support for QPS throttling

Slow start

ALB Ingress supports enabling slow start by using the alb.ingress.kubernetes.io/slow-start-enabled annotation and setting the slow start duration by using the alb.ingress.kubernetes.io/slow-start-duration annotation. The value range is 30 to 900 seconds (s).

Note

The longer the duration, the slower the traffic increases.

Backend slow start

Backend slow start

Connection draining

ALB Ingress supports connection draining. You can enable connection draining by using the alb.ingress.kubernetes.io/connection-drain-enabled annotation and set the timeout period by using the alb.ingress.kubernetes.io/connection-drain-timeout annotation. The timeout period can be set to a value from 0 to 900 seconds (s).

Connection draining

Connection draining

Mount Kubernetes pods and ECS instances as backend servers

ALB Ingress supports configuring backend server groups by using the alb.ingress.kubernetes.io/actions.<service-name> annotation. You can attach backend server groups by using a service name or a server group ID. This allows for a mixed attachment of Pods from within a Kubernetes cluster and Elastic Compute Service (ECS) instances from outside the cluster.

Use ALB Ingress to implement hybrid mounting, cross-region mounting, and on-premises IDC mounting

Use ALB Ingress to implement hybrid mounting, cross-region mounting, and on-premises IDC mounting

Mount cross-region and on-premises IDC resources by using a combination of products, such as Cloud Enterprise Network and Transit Router

By using ALB with products like Cloud Enterprise Network (CEN) and Transit Router, you can forward requests to servers in other regions' VPCs or to on-premises data centers.

JSON values in Ingress annotations must use standard English punctuation. Mixing Chinese and English punctuation causes an invalid character reconciliation error. Edit these values using an English input method.

ALB Ingress integrations

Alibaba Cloud integrations

Alibaba Cloud product

Feature

Description

Documentation

WAF

Enable WAF protection for ALB Ingress

Web Application Firewall (WAF) protects your applications from common web attacks. When WAF protection is enabled for an ALB Ingress, all traffic to the ALB instance is protected.

Enable WAF protection for ALB Ingress

EDAS

Create an application route (ALB Ingress)

Enterprise Distributed Application Service (EDAS) uses ALB Ingress for application routing. Based on Alibaba Cloud Application Load Balancer (ALB), ALB Ingress provides advanced traffic management, is compatible with Nginx Ingress, and handles complex business routing and automatic certificate discovery.

Create an application route (ALB Ingress)

SAE

Implement end-to-end canary releases based on Ingress gateways

You can use an ALB Ingress gateway to implement end-to-end traffic control for your SAE applications without modifying any business code.

ASM

Integrate with ALB by using an Ingress.

You can integrate Alibaba Cloud Service Mesh (ASM) with Application Load Balancer (ALB) by using an Ingress. This allows ALB users to leverage ASM's capabilities.

Integrate ASM with an Application Load Balancer instance

HPA

Integrate with ALB by using an Ingress.

You can integrate Horizontal Pod Autoscaler (HPA) with Application Load Balancer (ALB) by using an Ingress to enable automatic, QPS-based application autoscaling.

Use HPA to implement application autoscaling based on QPS data

Knative

Access services through ALB in ACK or ACK Serverless clusters where the Knative component is installed.

Knative is a Kubernetes-based serverless framework. You can use Knative to configure ALB service discovery and implement canary releases based on headers and cookies.

Use an ALB gateway

ACK One

Create a multi-cluster ALB gateway by using an Ingress.

Distributed Cloud Container Platform for Kubernetes (ACK One) is an enterprise-level cloud-native platform from Alibaba Cloud for scenarios such as hybrid clouds, multi-cluster management, distributed computing, and disaster recovery. The ACK One ALB multi-cluster gateway, which is the multi-cluster mode of ALB Ingress, allows you to implement active-active zone-disaster recovery, geo-disaster recovery, multi-cluster load balancing, and header-based routing to specific clusters.

Open source integrations

Open source product

Feature

Description

Documentation

Self-managed Kubernetes on the cloud

Use ALB in a self-managed Kubernetes cluster by using an Ingress.

In a Kubernetes cluster built on Elastic Compute Service (ECS) resources, you can use an Ingress to orchestrate ALB routing for automatic service discovery and in-cluster load balancing.

User guide for ALB Ingress on self-managed Kubernetes clusters