All Products
Search
Document Center

Alibaba Cloud Service Mesh:Install and use asmctl

Last Updated:Jul 20, 2023

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

  1. Download the binary executable file of asmctl. Select one of the following versions based on your operating system:

  2. Configure the runtime environment of asmctl.

    1. 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
    2. 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
    3. 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
    4. 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.

  1. Log on to the ACK console.
  2. In the left-side navigation pane of the ACK console, click Clusters.
  3. 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.
  4. 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.

  5. Create a config file in the $HOME/.kube folder and store the copied public access credential to the config file.

  6. 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.

  1. Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.
  2. On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose ASM Instance > Base Information.
  3. On the Base Information page, click Connection in the upper-right corner.

  4. In the Connection panel, click Copy in the upper-right corner of the Internal Access tab and click OK.

  5. Create an asmconfig file in the $HOME/.kube folder and store the copied public access credential to the asmconfig file.

  6. 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.