This topic describes how to use kubectl to connect to a cluster.

Background information

You can use the command-line tool kubectl to connect to a cluster from your on-premises machine.

Procedure

  1. Install and set up kubectl.
    For more information, see Install and set up kubectl.
  2. Configure the cluster user credentials.
    1. In the left-side navigation pane, choose Clusters > Clusters.
    2. On the Clusters page, click the name of the target cluster or click Manage for the target cluster in the Actions column.
    3. On the management page of the target cluster, click Connection Information.
      kubeconfig
      • To connect to the cluster over the Internet, click the Public Access tab and copy the content in the code editor to the $HOME/.kube/config directory of your on-premises machine. By default, kubectl obtains cluster user credentials from this directory.
      • To connect to the cluster over a virtual private cloud (VPC), click the Internal Access tab and copy the content in the code editor to the $HOME/.kube/config directory of your on-premises machine. By default, kubectl obtains cluster user credentials from this directory.

Result

  • If the target cluster is a managed cluster, you can run the kubectl command to connect to the cluster from your on-premises machine after you configure kubeconfig.

  • If the target cluster is a dedicated cluster, you can click the Basic Information tab and obtain the master node IP address for SSH connections. Then, you can run the kubectl command to connect to the cluster from your on-premises machine.Master node IP address for SSH connections
    Note To use SSH to log on to a dedicated cluster, select SSH Logon when you create the cluster. For more information, see Create an ACK cluster.