In addition to the Container Service for Kubernetes (ACK) console, you can also use the Kubernetes command-line tool kubectl to manage clusters and applications. This topic describes how to connect to an ACK cluster from a kubectl client.


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

    For more information, see Install and set up kubectl.

  3. Configure the cluster credentials.

    You can view cluster credentials on the details page of a cluster.

    1. Log on to the ACK console and click Clusters in the left-side navigation pane.
    2. Click the cluster whose credentials you want to view.
    3. Optional:Click the Basic Information tab. In the Cluster Information section, you can view the public and internal IP addresses that are used to connect to the cluster.
      Connect to a cluster
    4. Click the Connection Information tab and copy the cluster credentials to a local file on your on-premises machine.
      You can create a $HOME/.kube/config file and copy the cluster credentials to this file. This is the default file from which kubectl obtains the cluster credentials. You can also create another file, for example, /tmp/kubeconfig, and copy the cluster credentials to the file. Then, run the export KUBECONFIG=/tmp/kubeconfig command.
    5. Run the following command to check whether the kubectl client is connected to the cluster:
      kubectl get namespace
      Expected output:
      NAME              STATUS   AGE
      default           Active   4h39m
      kube-node-lease   Active   4h39m
      kube-public       Active   4h39m
      kube-system       Active   4h39m

What to do next

After the preceding operations are complete, you can use kubectl to connect to the ACK cluster from your on-premises machine.