- Documentation
Volcengine Kubernetes Engine
Volcengine Kubernetes Engine
User guide
Clusters
Connecting to clusters
Connecting to clusters using kubectl
Connecting to clusters
Connecting to clusters using kubectl
Connecting to clusters using kubectl
After you create a cluster, you can connect to it to access and manage cluster resources. VKE allows your local computer to access a Kubernetes cluster through kubectl.
kubectl is the native command-line tool provided by Kubernetes. It is used to interact with clusters. You can use kubectl to efficiently perform routine cluster O&M tasks in the terminal, such as resource management, application deployment, status checking, and debugging.
Based on your network environment plan, you can choose one of the following two methods to connect to clusters using kubectl:
- Private network access: The client communicates with the API server of clusters via a private IP address. Data traffic is entirely routed within VPCs and is not routed to the Internet. This provides high security and network stability.
- Public network access: The API server of clusters exposes entry points for public traffic. This allows clients to connect to the clusters via the Internet. After connecting to clusters, you also need to perform custom security configuration based on the security measures provided by VKE to ensure secure Internet communication. For details, see Configuring security groups.
- Download and install the latest version of the kubectl tool from the official Kubernetes website to your on-premises computer.
- Log in to the VKE console. In the top navigation bar, select the region where your business is located.
- In the left navigation bar, click Cluster. Find the target cluster and click its name.
- On the Overview page, click the Connection tab to obtain the cluster access credentials.
tip
For more operations on cluster access credentials, see the Manage cluster access credentials section in this topic.
On the Private network tab, click Generate KubeConfig to obtain cluster private access credentials. After you use the credentials to connect to the cluster, resources in the same VPC can access the cluster.
- In the Cluster API Server configuration section of the Overview tab, check whether Public access to API Server is switched on.
- Enable Public access to API Server if it is disabled.
warning
After you switch on Public access to API Server, VKE automatically creates an elastic IP address (EIP) of the BGP (Multipath) type and associates it with a Cloud Load Balancer (CLB) instance. You will be charged for using EIP. For details, see EIP billing overview. - On the Connection tab, click the Public network tab to obtain cluster public access credentials.
- Copy the cluster access credentials to the local $HOME/.kube/config file generated after you install kubectl.
warning
If you do not have the $HOME/.kube/config file, create a file and copy the access credentials into it.
- Run the following command in kubectl to check the status of namespaces in the cluster and verify that the connection is successful.
- If output similar to the following is returned, kubectl has connected to the cluster successfully.
- After obtaining cluster access credentials, review the security group settings provided by VKE to help secure cluster access. For details, see Configuring security groups.
Last updated: 2026.07.24 10:53:27