Manage a Kubernetes cluster in Cloud Shell

更新时间:
复制 MD 格式

Cloud Shell is a cloud command-line tool from Alibaba Cloud that allows you to manage Alibaba Cloud resources by running commands in any browser. This topic describes how to use Cloud Shell on the Container Service for Kubernetes (ACK) console to manage clusters by using kubectl.

Prerequisites

Cloud Shell connects to clusters only over the internet. Therefore, you must enable public access for the API server of your Kubernetes cluster. For more information, see Control public access to the API server of a Kubernetes cluster.

Background information

Cloud Shell is a web-based command-line tool. When you start Cloud Shell, it automatically provides you with a free Linux virtual machine. This virtual machine comes pre-installed with common tools and development environments, and includes a Web IDE to help you manage your cloud resources. For more information, see What is Cloud Shell?.

Note

When you launch Cloud Shell from the Container Service for Kubernetes (ACK) console, Cloud Shell automatically loads the cluster's kubeconfig file. You can then use kubectl to manage your cluster directly.

Procedure

  1. Log on to the ACS console. In the left navigation pane, click Clusters.

  2. On the Cluster page, find your target cluster and choose More > Open Cloud Shell in the Actions column.

  3. Optional: Click cloudshell.png. In the Mount Storage dialog box, click Mount Storage.

    Note

    Mounting a NAS file system lets you persist commonly used scripts and files. Otherwise, your files are deleted when the Cloud Shell session ends. Based on your requirements, click Create and Bind or Do Not Create.

  4. Run the following command to view the namespaces in the current cluster.

    kubectl get namespace

    The expected output is similar to the following:

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