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.
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.
For more information about AlbConfig fields, see ALB Ingress GlobalConfiguration dictionary.
For more information about how to use AlbConfigs to configure ALB instances, see Configure ALB instances and listeners.
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 |
| Yes | The name of the AlbConfig. |
| 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. |
| No | The name of the ALB instance. |
| No | The network type of the ALB instance. Valid values:
|
| 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
|
| 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.
For more information about annotations, see Annotations supported by ALB Ingresses.
For more information about how to configure Ingresses, see Configure Ingresses.