To connect to a Kubernetes cluster from a client computer, use the Kubernetes command line client kubectl.
- Download the latest kubectl client from the Kubernetes version page.
- Install and set the kubectl client.
For more information, see Install and set kubectl.
- Configure the cluster credentials.
You can view the cluster credentials on the cluster information page.
- Log on to the Container Service console.
- Under Kubernetes, click Clusters in the left-side navigation pane.
- Click Manage at the right of the cluster.
- In the Connection Information section, view the master node SSH IP address.
- 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
- After the preceding operation is performed, you can confirm the cluster connectivity by running the following command.
# kubectl cluster-info Kubernetes Master is running at https://xxxxxx.serverless-1.kubernetes.cn-shanghai.aliyuncs.com:6443
What to do next
After the configuration is complete, you can use kubectl to access the Kubernetes cluster from a local computer.