AMC is a command-line tool provided by Alibaba Cloud Distributed Cloud Container Platform (ACK One). AMC runs as a kubectl plug-in. This topic describes how to download and install AMC and the features of AMC. This topic also describes how to view the help information about AMC.

Download and install AMC

Run the following command to download the AMC package and make it executable. Then, you can run AMC as a kubectl plug-in.

AMC for Linux
wget http://ack-one.oss-cn-hangzhou.aliyuncs.com/kubectl-amc-linux && chmod +x kubectl-amc-linux && mv kubectl-amc-linux  /usr/local/bin/kubectl-amc
AMC for macOS
curl -LO http://ack-one.oss-cn-hangzhou.aliyuncs.com/kubectl-amc-mac && chmod +x kubectl-amc-mac && mv kubectl-amc-mac  /usr/local/bin/kubectl-amc

Features of AMC

  • You can use AMC in the same way you use kubectl.
  • You can connect to a master instance by using the kubeconfig file of the master instance and then perform the following operations:
    • Specify the name of a cluster that is managed by the master instance and connect to the cluster by using AMC. Then, you can manage the Deployments, Services, and Ingresses in the cluster.
    • Specify a task that is scheduled to a cluster managed by the master instance and connect to the cluster. Then, you can query information about the Kubernetes resources that are created for the task, such as pods and Services. You can also query the log of the task.

AMC help information

Run the following command to view the help information about AMC:

kubectl amc -h

Use AMC to query the associated clusters and the cluster aliases

Run the following command to query the associated clusters and the cluster aliases:

kubectl amc get managedcluster

Expected output:

Name                  Alias       HubAccepted
managedcluster-c****   cluster1    true
managedcluster-c****   cluster2    true
managedcluster-c****   cluster3    true
Note none is returned in the Alias column for clusters that are previously associated with ACK One.

To specify the alias of an associated cluster, run the following command:

kubectl annotate managedcluster <managedcluster name> ackone.aliyun.com/cluster-alias=<cluster-alias>

If there are associated cluster alias, to modify the alias of an associated cluster, run the following command:

kubectl annotate managedcluster <managedcluster name> ackone.aliyun.com/cluster-alias=<cluster-alias> --overwrite

Use AMC to query the status of resources that run in an associated cluster

Run the following command to query the status of the resources that run in an associated cluster:

kubectl amc get deployment -n demo -m managedcluster-c****    # Replace managedcluster-c**** with the name of the associated cluster that you want to manage. 

Expected output:

Run on ManagedCluster managedcluster-c**** (cluster-alias-****)
NAME       READY   UP-TO-DATE   AVAILABLE   AGE
web-demo   1/1     1            1           42h

Use AMC to query the status of resources that run in all associated clusters

Run the following command to query the status of the resources that run in all associated clusters:

kubectl amc get deployment -n demo -m all

Expected output:

Run on ManagedCluster managedcluster-c**** (cluster1)
NAME       READY   UP-TO-DATE   AVAILABLE   AGE
web-demo   1/1     1            1           42h
Run on ManagedCluster managedcluster-c**** (cluster2)
NAME       READY   UP-TO-DATE   AVAILABLE   AGE
web-demo   3/3     3            3           42h
Run on ManagedCluster managedcluster-c**** (cluster3)
NAME       READY   UP-TO-DATE   AVAILABLE   AGE
web-demo   5/5     5            5           42h

Use AMC to display the topology and status of applications and the relevant resources in associated clusters

Run the following command to query the status of applications and the relevant resources in associated clusters:

kubectl amc status demo -n demo --tree --detail

Expected output:

CLUSTER                                              NAMESPACE     RESOURCE        STATUS    APPLY_TIME          DETAIL
managedcluster-c****─── demo   ─┬─ Deployment/demo updated   2022-05-27 06:48:13 Ready: 4/4  Up-to-date: 4  Available: 4  Age: 8m2s
                               ├─ Ingress/demo    updated   2022-05-27 06:48:13 Class: <none>  Hosts: app.demo.example.com  Address:
                               │                                                 Ports: 80  Age: 8m2s
                               ├─ ConfigMap/demo  updated   2022-05-27 14:48:13 Data: 4  Age: 8m2s
                               └─ Service/demo    updated   2022-05-27 06:48:13 Type: ClusterIP  Cluster-IP: 192.168.9.178
                                                                                                                 External-IP: <none>  Port(s): 82/TCP  Age: 8m2s
managedcluster-c****─── demo   ─┬─ Deployment/demo updated   2022-05-27 06:48:16 Ready: 2/2  Up-to-date: 2  Available: 2  Age: 7m59s
                               ├─ Ingress/demo    updated   2022-05-27 06:48:15 Class: <none>  Hosts: app.demo.example.com  Address:
                               │                                                 Ports: 80  Age: 7m59s
                               ├─ ConfigMap/demo  updated   2022-05-27 14:48:17 Data: 4  Age: 7m58s
                               └─ Service/demo    updated   2022-05-27 06:48:15 Type: ClusterIP  Cluster-IP: 192.168.199.111
                                                                                                                 External-IP: <none>  Port(s): 82/TCP  Age: 7m59s