All Products
Search
Document Center

Container Service for Kubernetes:Use kubectl on Workbench or Cloud Shell to connect to ACK clusters

Last Updated:May 20, 2025

Workbench and Cloud Shell are web-based command-line tools provided by Alibaba Cloud that allow you to connect to and manage Container Service for Kubernetes (ACK) clusters without installing additional software. After you log on to the Alibaba Cloud Management Console, you can access Workbench or Cloud Shell directly in your browser. When launched, ACK automatically loads the kubeconfig file needed to connect to your cluster.

  • Workbench: A remote connection tool for ECS instances provided by Alibaba Cloud. No additional software installation is required. You can use Workbench to connect to an ACK cluster over the Internet or an internal network.

  • CloudShell: A shell tool provided by Alibaba Cloud that functions as an automatically created Linux virtual machine with various programming languages and command-line tools pre-installed. You can use Cloud Shell to connect to an ACK cluster only over the Internet.

    To connect over the Internet, you must attach an Alibaba Cloud Elastic IP Address (EIP) to the API Server of the cluster to enable Internet access. For more information, see Enable Internet access to the API server.

    The VM created by Cloud Shell is valid for only 1 hour. When the VM expires, Cloud Shell immediately destroys it. If no interactive operation is performed for 30 minutes or all sessions are closed, the VM is destroyed after 15 minutes. When you launch Cloud Shell again, a new VM is created.

Preparations

  • A RAM user must be granted permissions to operate the cluster in addition to the system permissions for Container Service before connecting to a cluster. For more information, see Authorization.

  • A RAM user must be granted the AliyunCloudShellFullAccess permission before using Cloud Shell. If the RAM user needs to create and attach a NAS file system, the AliyunNASFullAccess permission is also required. For more information, see Grant permissions to a RAM user.

Procedure

Based on the Internet connectivity of the cluster, the upper-right corner of the Cluster Information page displays options to connect to the cluster through Workbench or Cloud Shell. You can select an option as prompted on the page.

Workbench

  1. Log on to the ACK console. In the left-side navigation pane, click Clusters.

  2. On the Clusters page, find the cluster that you want to manage and click its name. In the left-side pane, click Cluster Information.

  3. On the Cluster Information page, click Manage Cluster With Workbench in the upper-right corner.

  4. In the terminal that appears, you can run kubectl commands to connect to the cluster.

    Run the following command to query the namespaces of the cluster:

    kubectl get namespace

    Expected output:

    NAME              STATUS   AGE
    default           Active   3h14m
    kube-node-lease   Active   3h14m
    kube-public       Active   3h14m
    kube-system       Active   3h14m

CloudShell

  1. Log on to the ACK console. In the left-side navigation pane, click Clusters.

  2. On the Clusters page, find the cluster that you want to manage and click its name. In the left-side pane, click Cluster Information.

  3. On the Cluster Information page, click Manage Cluster With CloudShell in the upper-right corner.

  4. Optional: Click cloudshell.png, and then click Mount Storage Space.

    You can associate and mount a NAS file system to persist files and scripts that are commonly used. This ensures the files and scripts are not deleted when the NAS file system is released. You can select Create And Bind or Do Not Create as needed.

  5. Run kubectl commands to connect to the cluster.

    Run the following command to query the namespaces of the cluster:

    kubectl get namespace

    Expected output:

    NAME              STATUS   AGE
    default           Active   3h14m
    kube-node-lease   Active   3h14m
    kube-public       Active   3h14m
    kube-system       Active   3h14m