Service Mesh (ASM) provides asmctl to help you diagnose the configurations of ASM instances. This topic describes how to install and use asmctl to connect to clusters and ASM instances.
Compatibility
ASM does not ensure the compatibility with Istioctl that is provided by the Istio community. However, ASM provides asmctl that supports partial Istioctl commands.
You can use asmctl in Container Service for Kubernetes (ACK) clusters and ASM instances of the following versions:
Standard ASM instances whose version is v1.8.6.49-gda24841c-aliyun or later
Professional managed ACK clusters whose version is v1.20.4-aliyun-1 or later
If you use asmctl in ASM instances whose version is earlier than v1.8.6.49-gda24841c-aliyun, specific commands may be unavailable.
Install asmctl
Download the binary executable file of asmctl. Select one of the following versions based on your operating system:
Configure the runtime environment of asmctl.
Run the following command to create an .istioctl/bin folder:
# You can install asmctl and Istioctl in the same folder to ease management. # If you have installed Istioctl by following the instructions on the official website of Istio, you do not need to create the folder. mkdir $HOME/.istioctl/bin
Run the following command to move the binary executable file of asmctl to the .istioctl/bin folder:
# You must replace $PATH_TO_ASMCTL with the actual path of the binary executable file of asmctl. mv $PATH_TO_ASMCTL/asmctl $HOME/.istioctl/bin/asmctl
Run the following command to add the path of the binary executable file of asmctl to the PATH environment variable:
# Add the path of the binary executable file of asmctl to the PATH environment variable. export PATH=$PATH:$HOME/.istioctl/bin
Run the following command to grant execute permissions to asmctl:
# Grant execute permissions to asmctl. chmod +x ".istioctl/bin/asmctl"
Use asmctl
Before you use asmctl to diagnose clusters and ASM instances, you must configure the connection credentials of clusters and ASM instances. By default, the connection credentials of clusters are stored in the $HOME/.kube/config file, and the connection credentials of ASM instances are stored in the $HOME/.kube/asmconfig file. You can run the --kubeconfig
or -c
command to change the path of the connection credentials of clusters, and run the --asmconfig
or -m
command to change the path of the connection credentials of ASM instances. For more information about common asmctl commands, see Common asmctl commands.
Use asmctl to connect to a cluster
In this example, use asmctl to connect to an ACK cluster by using a public access credential.
- Log on to the ACK console.
- In the left-side navigation pane of the ACK console, click Clusters.
- On the Clusters page, find the cluster that you want to manage and click the name of the cluster or click Details in the Actions column. The details page of the cluster appears.
On the details page of the cluster, click the Connection Information tab. Then, click Copy in the upper-right corner of the Public Access tab.
Create a config file in the $HOME/.kube folder and store the copied public access credential to the config file.
Run the following command to check whether the cluster is connected:
kubectl get ns
If namespace information is returned, the cluster is connected by using asmctl.
Use asmctl to connect to an ASM instance
In this example, use asmctl to connect to an ASM instance by using a public access credential.
- 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 Base Information page, click Connection in the upper-right corner.
In the Connection panel, click Copy in the upper-right corner of the Internal Access tab and click OK.
Create an asmconfig file in the $HOME/.kube folder and store the copied public access credential to the asmconfig file.
Run the following command to check whether the ASM instance is connected:
kubectl get ns --kubeconfig $HOME/.kube/asmconfig
If namespace information is returned, the ASM instance is connected by using asmctl.