All Products
Search
Document Center

Container Service for Kubernetes:Overview of ALB multi-cluster gateways

Last Updated:Nov 25, 2024

The Application Load Balancer (ALB) multi-cluster gateways provided by Distributed Cloud Container Platform for Kubernetes (ACK One) are the multi-cluster mode of ALB Ingress. In most cases, ALB multi-cluster gateways can be used in the same manner as the single-cluster mode of ALB Ingress, except for several differences. This topic describes multi-cluster ALB Ingresses.

ALB Ingress

ALB Ingresses are developed based on Application Load Balancer (ALB) and serve as unified ingresses for Services in Container Service for Kubernetes (ACK) clusters. Compared with NGINX Ingresses, ALB Ingresses are fully hosted. You do not need to manually maintain ALB Ingresses. ALB Ingresses can automatically detect changes in Ingress resources in Kubernetes clusters and then distribute traffic to backend Services based on the predefined routing rules. In addition, ALB Ingresses adopt a powerful auto scaling mechanism to automatically adapt to fluctuating traffic to ensure system stability. The following figure shows the logical relationship between an ALB instance and a multi-cluster ALB Ingress.

image
  • ALB Ingress controller: a component that manages Ingress resources. The ALB Ingress controller uses the API server in the cluster to dynamically obtain changes in Ingress resources and updates the ALB instance based on the Ingress routing rules. The ALB Ingress controller is a control plane of the ALB instance. It manages the ALB instance but does not distribute traffic. Traffic is distributed by the ALB instance.

  • AlbConfig: An AlbConfig is a CustomResourceDefinition (CRD) created by the ALB Ingress controller. The parameters in the AlbConfig define the configuration of the ALB instance. Each AlbConfig corresponds to one ALB instance. The ALB instance serves as an ingress to distribute traffic to backend Services. The ALB instance is fully hosted by ALB. Compared with the NGINX Ingress controller, ALB Ingresses are O&M-free and extremely elastic.

  • IngressClass: An IngressClass is an attribute of a Kubernetes Ingress that defines the class or identifier of an Ingress controller. IngressClasses allow you to use multiple Ingress controllers in a cluster and specify a controller for each Ingress.

  • Ingress: Ingresses are resource objects that define external traffic routing rules and access control rules. The ALB Ingress controller monitors changes in Ingress resources and updates the ALB instance to distribute traffic.

  • Service: In Kubernetes, pods are considered temporary and unstable resources. Services provide a stable and centralized entry for pods that have the same function. Other applications or Services can communicate with the pods by using the virtual IP address and port of the Service without worrying about any changes in the pods. For more information about Services, see Getting started.

Configure an AlbConfig

In multi-cluster mode, the alb.ingress.kub ernetes.io/remote-clusters annotation is added to the AlbConfig to specify the cluster that is associated with the ALB instance and used to distribute traffic. The following AlbConfig is used to create a multi-cluster gateway.

Note
apiVersion: alibabacloud.com/v1
kind: AlbConfig
metadata:
  name: ackone-gateway-demo
  annotations:
    # Add the associated cluster that is used to distribute traffic to the ALB multi-cluster instance. 
    alb.ingress.kubernetes.io/remote-clusters: ${cluster1},${cluster2}
spec:
  config:
    name: one-alb-demo
    addressType: Internet
    addressAllocatedMode: Fixed
    zoneMappings:
    - vSwitchId: ${vsw-id1}
    - vSwitchId: ${vsw-id2}
  listeners:
  - port: 8001
    protocol: HTTP

The following table describes the parameters.

Parameter

Required

Description

metadata.name

Yes

The name of the AlbConfig.

metadata.annotations:

alb.ingress.kubernetes.io/remote-clusters

Yes

The list of associated clusters to be added to the ALB multi-cluster gateway. The cluster IDs listed here have been associated with the Fleet instance.

spec.config.name

No

The name of the ALB instance.

spec.config.addressType

No

The network type of the ALB instance. Valid values:

  • Internet (default): Public network. The ALB instance provides services to the Internet and is accessible over the Internet.

    Note

    To allow an ALB instance to provide Internet-facing services, the ALB instance needs to be associated with an elastic IP address (EIP). If you use an Internet-facing ALB instance, you are charged instance fees and bandwidth or data transfer fees for the associated EIPs. For more information, see Pay-as-you-go.

    Intranet: Private network. The ALB instance provides services within a VPC and cannot be accessed over the Internet.

spec.config.zoneMappings

Yes

The IDs of the vSwitches that are associated with the ALB instance. For more information about how to create a vSwitch, see Create and manage a vSwitch.

Note
  • The specified vSwitches must be deployed in the zones supported by the ALB instance and deployed in the same VPC as the cluster. For more information about regions and zones supported by ALB, refer to Regions and zones in which ALB is available.

  • ALB supports multi-zone deployment. If the current region supports two or more zones, select vSwitches in at least two zones to ensure high availability.

spec.listeners

No

The listener port and protocol of the ALB instance. The example provided in this topic configures an HTTP listener on port 8001.

A listener defines how ALB receives traffic. We recommend that you retain the listener configuration. Otherwise, you must create a listener before you can use ALB Ingresses.

Ingress configuration

Most configurations of a multi-cluster ALB Ingress are similar to the configurations of a single-cluster ALB Ingress. However, the traffic splitting by weight and the canary release feature cannot be used at the same time in multi-cluster mode.