All Products
Search
Document Center

Container Service for Kubernetes:Use kubectl on Cloud Shell to manage ACK clusters

Last Updated:Oct 31, 2024

Cloud Shell is a web-based command-line tool provided by Alibaba Cloud. You can use Cloud Shell to run commands in a browser to manage Alibaba Cloud resources. This topic describes how to use kubectl on Cloud Shell in the Container Service for Kubernetes (ACK) console to manage ACK clusters.

Prerequisites

Cloud Shell can connect to ACK clusters only from the Internet. Therefore, you must make sure that the API server of the cluster that you want to manage is accessible over the Internet. For more information, see Control public access to the API server of a cluster.

Background information

Cloud Shell is a web-based command-line tool. When you start Cloud Shell, Cloud Shell automatically creates a Linux VM for you. The Linux VM is free of charge. The VM is pre-installed with cloud management tools and system tools. You can use these tools with Web IDE provided by Cloud Shell to manage cloud resources. For more information, see What is Cloud Shell? .

Note

When you open Cloud Shell in the ACK console, the system automatically loads the kubeconfig file of the cluster. Then, you can use kubectl to manage the cluster.

Procedure

  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 choose More > Open Cloud Shell in the Actions column.

  3. Optional: Click the cloudshell.png icon and then click Mount File Storage.

    You can associate and mount an File Storage NAS (NAS) file system to persist files and scripts that are commonly used. This way, the files and scripts are not deleted when the NAS file system is released. You can click Create Now or Skip based on your requirements.

  4. Run the following command to query the namespaces in 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