Connect to a Kubernetes cluster by using kubectl

Last updated:2021-05-11 10:41:36

You can use the Kubernetes command-line tool kubectl to connect to a Kubernetes cluster on Kingsoft Cloud from a local PC.

Install kubectl

For more information about how to install kubectl, see Install Tools.

Obtain the cluster credentials

  1. Log in to the KCE console.
  2. In the left navigation pane, click Cluster.
  3. Click the name of a cluster to go to the cluster management page.
  4. On the Basic Information page, click Get Cluster Config.
  5. In the dialog box that appears, obtain the cluster credentials.

Configure the kubeconfig file

Download the configuration file of the cluster and copy the content of the configuration file to the $HOME/.kube/config file on the local PC. The $HOME/.kube/config file is the default configuration file used by kubectl.

Connect to the cluster

After the configuration is complete, you can use kubectl to connect to the cluster from the local PC and run cluster management commands. Example:

kubectl get node

Did you find the above information helpful?

Mostly Unhelpful
A little helpful
Very helpful

What might be the problems?

Unclear or awkward
Redundant or clumsy
Lack of context for the complex system or functionality

More suggestions


Please give us your feedback.


Thank you for your feedback.