Service Mesh (ASM) allows you to view the topology of an application. This topic describes how to observe the effect of the zone aware routing feature on the topology of an ASM instance. The access to a Bookinfo application by using an ingress gateway is used as an example.
Prerequisites
- An ASM instance is created. For more information, see Create an ASM instance.
- An ACK managed cluster is created. For more information, see Create an ACK managed cluster.
- The cluster is added to the ASM instance. For more information, see Add a cluster to an ASM instance.
Nodes in the ACK cluster reside in at least two zones. The cn-hangzhou-j and cn-hangzhou-k zones are used in this topic. You can view the region and zone where the ECS instance that corresponds to a cluster node resides in the ACK console. For more information, see Regions and zones.
An ingress gateway is deployed. The topology of the ASM instance can be viewed. For more information, see Get started.
A Helm 3 client is installed. For more information, see Helm.
Step 1: Deploy a sample application
Download the Helm installation package that is used to deploy a sample application.
Decompress the package and open the asm-az-routing directory in the folder obtained after decompression. Specify the zones where you want to deploy the application in the values.yaml file.
In this example, the following zone settings are used:
zone1: cn-hangzhou-j zone2: cn-hangzhou-k
Run the following command to deploy a sample application:
helm install --namespace azdemo azdemo ./
When the application pod runs properly, run the following command to access the service by using the ingress gateway:
while true; do curl -I http://{IP address of the ingress gateway}/productpage ; echo;sleep 1; done
Step 2: Log on to Mesh Topology and view the topology of the ASM instance
- Log on to the ASM console. In the left-side navigation pane, choose .
- On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose .
On the Mesh Topology page, click Copy token and open in new window.
On the logon page of Mesh Topology, enter the token and click log in.
Select the namespace of the ASM instance, select Traffic Distribution, Traffic Rate, and Traffic Animation from the Display drop-down list, and deselect Service Nodes.
The following figure shows an example topology.
Step 3: Observe the topology to verify automatic route switching between zones
Reduce the number of pods to zero for reviews-v1 that is deployed in the first zone. This way, the service becomes unavailable.
Log on to the ACK console and click Clusters in the left-side navigation pane.
On the Clusters page, click the name of a cluster and choose in the left-side navigation pane.
Find the deployment and click Scale in the Actions column, set Desired Number of Pods to 0, and then click OK.
Go back to the topology page that you logged on to in Step 2: Log on to Mesh Topology and view the topology of the ASM instance.
The following figure shows an example topology.The topology shows that productpage v1 points to reviews-v2. This change indicates that when the reviews service in the same zone becomes unavailable, the request is automatically routed to the reviews service in another zone.
Step 4: Observe the topology to verify the zone aware routing feature
Increase the number of pods to one for reviews-v1 that is deployed in the first zone. This way, the service becomes available.
Log on to the ACK console and click Clusters in the left-side navigation pane.
On the Clusters page, click the name of a cluster and choose in the left-side navigation pane.
Find the deployment and click Scale in the Actions column, set Desired Number of Pods to 1, and then click OK.
Go back to the topology page that you logged on to in Step 2: Log on to Mesh Topology and view the topology of the ASM instance.
The following figure shows an example topology.The topology shows that productpage v1 points to reviews-v1 that is deployed in the same zone. The result indicates that the zone aware routing feature takes effect.