AMC is a kubectl plug-in for Distributed Cloud Container Platform for Kubernetes (ACK One). It extends kubectl to work across multiple clusters managed by a Fleet instance, so you can query and inspect resources in any managed cluster without switching kubeconfig files.
With AMC, you can:
-
Use AMC in the same way you use kubectl
-
Connect to a Fleet instance and manage Deployments, Services, and Ingresses in any cluster it manages
-
Query the status of Kubernetes resources (Pods, Services) in a specific managed cluster or across all managed clusters simultaneously
-
View task logs for workloads scheduled to a managed cluster
-
Inspect the full topology and status of an application and its related resources across managed clusters
Prerequisites
Before you begin, ensure that you have:
-
An ACK One Fleet instance with at least one associated cluster
-
The kubeconfig file of the Fleet instance
-
wget(Linux) orcurl(macOS) installed
Install AMC
Download the AMC binary for your platform and architecture, make it executable, and move it to /usr/local/bin.
Linux
| Architecture | Command |
|---|---|
| amd64 | wget http://ack-one.oss-cn-hangzhou.aliyuncs.com/kubectl-amc-linux-amd64 && chmod +x kubectl-amc-linux-amd64 && mv kubectl-amc-linux-amd64 /usr/local/bin/kubectl-amc |
| arm64 | wget http://ack-one.oss-cn-hangzhou.aliyuncs.com/kubectl-amc-linux-arm64 && chmod +x kubectl-amc-linux-arm64 && mv kubectl-amc-linux-arm64 /usr/local/bin/kubectl-amc |
macOS
| Architecture | Command |
|---|---|
| amd64 | curl -LO http://ack-one.oss-cn-hangzhou.aliyuncs.com/kubectl-amc-mac-amd64 && chmod +x kubectl-amc-mac-amd64 && mv kubectl-amc-mac-amd64 /usr/local/bin/kubectl-amc |
| arm64 | curl -LO http://ack-one.oss-cn-hangzhou.aliyuncs.com/kubectl-amc-mac-arm64 && chmod +x kubectl-amc-mac-arm64 && mv kubectl-amc-mac-arm64 /usr/local/bin/kubectl-amc |
Verify the installation
Run kubectl amc -h to confirm AMC is installed and view its help output:
kubectl amc -h
List managed clusters and aliases
Run kubectl amc get managedcluster to list all clusters associated with the Fleet instance and their aliases:
kubectl amc get managedcluster
Expected output:
Name Alias HubAccepted
managedcluster-c**** cluster1 true
managedcluster-c**** cluster2 true
managedcluster-c**** cluster3 true
Clusters previously associated with ACK One return none in the Alias column.
Set a cluster alias
To set an alias for an associated cluster:
kubectl annotate managedcluster <managedcluster name> ackone.aliyun.com/cluster-alias=<cluster-alias>
To update an existing alias, add --overwrite:
kubectl annotate managedcluster <managedcluster name> ackone.aliyun.com/cluster-alias=<cluster-alias> --overwrite
Query resources in a managed cluster
Use the -m flag to target a specific managed cluster by name, or pass -m all to query all associated clusters at once.
| Flag | Description |
|---|---|
-n <namespace> |
Namespace to query |
-m <cluster-name> |
Name of the managed cluster to target; use all for all clusters |
Query a specific cluster
kubectl amc get deployment -n demo -m managedcluster-c****
Replace managedcluster-c**** with the name of the cluster you want to inspect.
Expected output:
Run on ManagedCluster managedcluster-c**** (cluster-alias-****)
NAME READY UP-TO-DATE AVAILABLE AGE
web-demo 1/1 1 1 42h
Query 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
Inspect application topology
Use appstatus with --tree and --detail to display the full topology of an application and the status of all its associated resources across managed clusters.
| Flag | Description |
|---|---|
--tree |
Displays resources in a tree structure showing parent-child relationships |
--detail |
Includes detailed status information for each resource |
kubectl amc appstatus 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