tencent cloud

Tencent Kubernetes Engine Distributed Cloud Center

Release Notes and Announcements
Release Notes
Tencent Kubernetes Engine Distributed Cloud Center Open Source Statement
Product Introduction
Overview
Strengths
Scenarios
Operation Guide
Distributed Infrastructures
Distributed Application Management
Related Agreement
PRIVACY POLICY MODULE
DATA PROCESSING AND SECURITY AGREEMENT MODULE

Connecting to a Registered Cluster

PDF
Modo Foco
Tamanho da Fonte
Última atualização: 2025-04-17 19:48:13
In addition to viewing and managing TKE clusters and third-party clusters on the cluster management page through the TKE Console, you can also connect to and access the registered cluster from your local client machine using the Kubernetes command-line tool, Kubectl.

Prerequisites

The curl software has be installed.
Choose the method to obtain the Kubectl tool based on your operating system type:
Note:
For your actual version, replace 'v1.8.13' in the command line with the Kubectl version required for your business.
MacOS system
Linux system
Windows system
Execute the following command to obtain the Kubectl tool:
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.13/bin/darwin/amd64/kubectl
Execute the following command to obtain the Kubectl tool:
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.13/bin/linux/amd64/kubectl
Execute the following command to obtain the Kubectl tool:
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.13/bin/windows/amd64/kubectl.exe

Directions

Installing the Kubectl Tool

1. See Installing and Setting up kubectl to install the Kubectl tool.
Note:
If you have already installed the Kubectl tool, skip this step.
This step uses the Linux system as an example.
2. Execute the following commands sequentially to add execution permissions.
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
3. Execute the following command to test the installation result.
kubectl version
If the output is similar to the following version information, it indicates that the installation was successful.
Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.2", GitCommit:"08e099554f3c31f6e6f07b448ab3ed78d0520507", GitTreeState:"clean", BuildDate:"2017-01-12T04:57:25Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}

Configuring Kubeconfig

1. Log in to the TKE console, and select Cluster in the left sidebar.
2. On the cluster list page, click the ID of the registered cluster you want to connect to, and you will be redirected to the cluster's basic information page.
3. In the Cluster API Server information, obtain the corresponding kubeconfig for public network access or private network access. You can either copy or download it.
4. Configure the cluster credentials based on the actual situation. For more details, see the instructions for connecting to the Kubernetes cluster via Kubectl in the console.

Accessing the Kubernetes Cluster

1. After completing the Kubeconfig configuration, execute the following commands sequentially to view and switch contexts to access the cluster.
kubectl config get-contexts
kubectl config use-context cls-3jju4zdc-context-default
2. Execute the following command to test if the cluster is accessible.
kubectl get pod
If you are unable to connect to the cluster, check whether public network access or private network access has been enabled, and ensure that the access client is within the specified network environment.

Introduction to Kubectl Command Line

Kubectl is a command-line tool used for operating Kubernetes clusters. This document covers the Kubectl syntax, and common command operations, and provides typical examples. For detailed information on each command (including all main commands and subcommands), see Kubectl Reference Document or use the kubectl help command to view detailed help.


Ajuda e Suporte

Esta página foi útil?

comentários