To ensure service stability, you can deploy multiple Container Service for Kubernetes (ACK) clusters in a peer-to-peer manner to achieve high availability. A Cloud-native API Gateway instance supports access from multiple ACK clusters. An instance is associated with multiple clusters, combines services with identical names, and implements load balancing among multiple services. You can use the feature together with the health check feature of Cloud-native API Gateway to automatically detect service availability and implement automatic traffic switching upon failures in an efficient manner. This topic describes how to use a Cloud-native API Gateway instance to manage multiple ACK clusters.
Prerequisites
Two ACK clusters are created. For more information, see Create an ACK managed cluster.
Services with identical names are deployed in the two ACK clusters. The following sample code is used for a service named
httpbin.
Background
In production practices, if high business stability is required, you can deploy multiple ACK clusters in a peer-to-peer manner to ensure high availability. For example, Cluster A is deployed in Zone A and Cluster B is deployed in Zone B. The same services are deployed in the two clusters. If a cluster fails, traffic is switched to services in the other cluster.
Cloud-native API Gateway provides the multi-cluster access feature to meet the high-availability deployment requirements of your business. If a Cloud-native API Gateway instance is associated with both Cluster A and Cluster B, the instance combines the services with identical names in the two clusters into one service. The name of the combined service is the same as the original service names, but the IP address list of the combined service contains all the IP addresses of the two services. If Cluster A or B fails, all traffic is automatically distributed to the normal cluster by using the routing capability of the instance. We recommend that you use this feature together with the active health check feature of the instance. The active health check feature allows the instance to actively detect the IP address availability of services. This helps implement automatic traffic switchover.
In the following figure, a Cloud-native API Gateway instance manages Services A and B in two ACK clusters. If a crash occurs in Cluster B, you can still access Services A and B in Cluster A by using the instance. All traffic is automatically switched to Cluster A without human intervention.

Step 1: Add ACK service sources to the Cloud-native API Gateway instance
Log on to the Cloud-native API Gateway console.
In the left-side navigation pane, click Instance. In the top navigation bar, select a region.
On the Instance page, click the name of the gateway instance that you want to manage.
In the left-side navigation tree, click Service. Then, click the Source tab.
Click Create Source. In the Create Source panel, select ACK below Source Type and configure parameters as prompted. Then, click OK. For more information, see Add a service source.

Step 2: Add Services A and B to the Cloud-native API Gateway instance
Log on to the Cloud-native API Gateway console.
In the left-side navigation pane, click Instance. In the top navigation bar, select a region.
On the Instance page, click the name of the gateway instance that you want to manage.
In the left-side navigation tree, click Service. Then, click the Services tab.
On the Services tab, click Create Service. In the Create Service panel, set Service Source to ACK, specify the Namespace and Services parameters, and then click OK. For more information, see Create a service.

Step 3: Add a routing rule for the services in the Cloud-native API Gateway instance
Create an HTTP API. For more information, see Create an HTTP API.
Click the target API and click Create Route in the upper-left corner.
In the Create Route panel, configure the parameters and click Save and Publish. For more information, see Create a route.

Check the result
Clusters A and B are normal
On the Services tab, view the IP addresses of the service.
Two IP addresses are displayed.

Access the Cloud-native API Gateway instance multiple times. The following code shows that two different hostnames are returned:
curl <Instance endpoint>/version
Cluster A fails
Remove the httpbin service from Cluster A.
In this case, only one IP address is available, as shown in the following figure:

Access the Cloud-native API Gateway instance multiple times. The following code shows that only one hostname is returned:
curl <Instance endpoint>/version