To connect to a Kubernetes cluster from a client computer, use the Kubernetes command line client kubectl.

Procedure

  1. Download the latest kubectl client from the Kubernetes version page.
  2. Install and set the kubectl client.

    For more information, see Install and set 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. Under Kubernetes, click Clusters in the left-side navigation pane.
    3. Click Manage at the right of the cluster.
    4. In the Connection Information section, view the master node SSH IP address.


    5. Copy the cluster credentials to a local file, and you can create and save the cluster credentials to $HOME/.kube/config (location where kubectl credentials are to be stored). You can also name a new file, such as /tmp/kubeconfig, and run the export KUBECONFIG=/tmp/kubeconfig command.
    6. After the preceding operation is performed, you can confirm the cluster connectivity by running the following command.
      #kubectl get pod
      No resources found.

What to do next

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