This topic describes how to use the Kubernetes command-line client kubectl to connect to a Kubernetes cluster from a local computer.


  1. Download the latest kubectl client from the Kubernetes version description page.
  2. Install and configure the kubectl client.
    For more information, see Install and configure kubectl.
  3. Configure the cluster credentials.
    You can view the cluster credentials on the cluster information page.
    1. Log on to the Container Service console.
    2. In the left-side navigation pane under Container Service - Kubernetes, choose Clusters > Clusters. The Clusters page appears.
    3. In the Actions column of the target cluster, click Manage.
    4. View the endpoint of the cluster in the Cluster Information section.
      Connect to a cluster
    5. Copy the cluster credentials to a local file. You can create the $HOME/.kube/config file and copy the cluster credentials to this file. This is the default file from which kubectl obtains cluster credentials. You can also create a file, such as /tmp/kubeconfig, and copy the cluster credentials to the file. Then, run the export KUBECONFIG=/tmp/kubeconfig command.
    6. After completing the preceding configuration, run the following command to check whether the kubectl client is connected to the cluster:
      #kubectl get pod
      No resources found.

What to do next

After completing the configuration, you can use kubectl to access the Kubernetes cluster from a local computer.