tencent cloud

Tencent Kubernetes Engine

Release Notes and Announcements
Release Notes
Announcements
Release Notes
Product Introduction
Overview
Strengths
Architecture
Scenarios
Features
Concepts
Native Kubernetes Terms
Common High-Risk Operations
Regions and Availability Zones
Service Regions and Service Providers
Open Source Components
Purchase Guide
Purchase Instructions
Purchase a TKE General Cluster
Purchasing Native Nodes
Purchasing a Super Node
Getting Started
Beginner’s Guide
Quickly Creating a Standard Cluster
Examples
Container Application Deployment Check List
Cluster Configuration
General Cluster Overview
Cluster Management
Network Management
Storage Management
Node Management
GPU Resource Management
Remote Terminals
Application Configuration
Workload Management
Service and Configuration Management
Component and Application Management
Auto Scaling
Container Login Methods
Observability Configuration
Ops Observability
Cost Insights and Optimization
Scheduler Configuration
Scheduling Component Overview
Resource Utilization Optimization Scheduling
Business Priority Assurance Scheduling
QoS Awareness Scheduling
Security and Stability
TKE Security Group Settings
Identity Authentication and Authorization
Application Security
Multi-cluster Management
Planned Upgrade
Backup Center
Cloud Native Service Guide
Cloud Service for etcd
TMP
TKE Serverless Cluster Guide
TKE Registered Cluster Guide
Use Cases
Cluster
Serverless Cluster
Scheduling
Security
Service Deployment
Network
Release
Logs
Monitoring
OPS
Terraform
DevOps
Auto Scaling
Containerization
Microservice
Cost Management
Hybrid Cloud
AI
Troubleshooting
Disk Full
High Workload
Memory Fragmentation
Cluster DNS Troubleshooting
Cluster kube-proxy Troubleshooting
Cluster API Server Inaccessibility Troubleshooting
Service and Ingress Inaccessibility Troubleshooting
Common Service & Ingress Errors and Solutions
Engel Ingres appears in Connechtin Reverside
CLB Ingress Creation Error
Troubleshooting for Pod Network Inaccessibility
Pod Status Exception and Handling
Authorizing Tencent Cloud OPS Team for Troubleshooting
CLB Loopback
API Documentation
History
Introduction
API Category
Making API Requests
Elastic Cluster APIs
Resource Reserved Coupon APIs
Cluster APIs
Third-party Node APIs
Relevant APIs for Addon
Network APIs
Node APIs
Node Pool APIs
TKE Edge Cluster APIs
Cloud Native Monitoring APIs
Scaling group APIs
Super Node APIs
Other APIs
Data Types
Error Codes
TKE API 2022-05-01
FAQs
TKE General Cluster
TKE Serverless Cluster
About OPS
Hidden Danger Handling
About Services
Image Repositories
About Remote Terminals
Event FAQs
Resource Management
Service Agreement
TKE Service Level Agreement
TKE Serverless Service Level Agreement
Contact Us
Glossary
DocumentaçãoTencent Kubernetes EngineUse CasesOPSUsing kubecm to Manage Multiple Clusters kubeconfig

Using kubecm to Manage Multiple Clusters kubeconfig

PDF
Modo Foco
Tamanho da Fonte
Última atualização: 2024-12-13 21:12:47

Overview

Kubectl is a command line tool provided by Kubernetes for performing operations on clusters. It uses kubeconfig as a configuration file (the default path is ~/.kube/config) to configure the information of multiple clusters, and manage and operate multiple clusters.
To manage and operate the TKE or TKE Serverless cluster through Kubectl, you need to enable the APIServer's public or private network access on the cluster basic information page to obtain kubeconfig (cluster access credentials). If you need to use kubectl to manage multiple clusters, generally you need to extract the contents of each field in kubeconfig and merge them into the kubeconfig file of the device where kubectl locates. This method is complicated and may easily cause an error.
Through the kubecm tool, you can merge multiple cluster access credentials into kubeconfig more simply and efficiently. This document describes how to use kubecm to efficiently manage the kubeconfig of multiple clusters.

Prerequisites

You have installed the kubectl command line tool on the device used for managing multiple clusters.

Directions

Installing kubecm

Install kubecm on the device used for managing multiple clusters.

Obtaining cluster access credential

After creating a cluster, you need to follow the steps below to obtain access credential for the cluster:
1. Log in to the TKE console and click Cluster in the left sidebar.
2. Click the ID/name of the cluster for which the access credential needs to be obtained to go to the basic information page of the cluster.
3. On the Basic Information page, enable Internet access and Private network access in the Cluster APIServer Information section.
4. Click Download on the right of KubeConfig.


Using kubecm to add access credential to kubeconfig

This document takes the cluster access credential cls-l6whmzi3-config as an example. Run the following command to use kubecm to add the access credential to kubeconfig (-n means you can specify the context name):
kubecm add -f cls-l6whmzi3-config -n cd -c

Viewing the cluster list

Run the following kubecm ls command to view the cluster list in kubeconfig (the asterisk identifies the cluster under operation):
$ kubecm ls
+------------+------------+-----------------------+--------------------+-----------------------------------+-------------------+
| CURRENT | NAME | CLUSTER | USER | SERVER | Namespace |
+============+============+=======================+====================+===================================+===================+
| * | cd | cluster-chh6kgf9d9 | user-chh6kgf9d9 | https://cls-l6whmzi3.ccs.tence | default |
| | | | | nt-cloud.com | |
+------------+------------+-----------------------+--------------------+-----------------------------------+-------------------+
| | bj | cluster-6qaua96n | user-6qaua96n | https://cls-6qaua96n.ccs.tence | kube-system |
| | | | | nt-cloud.com | |
+------------+------------+-----------------------+--------------------+-----------------------------------+-------------------+

Switching the cluster

Run the following kubecm switch command to interactively switch to another cluster:


Removing the cluster

Run the following kubecm delete command to remove a cluster:
$ kubecm delete bj
Context Delete:「bj」
「/Users/roc/.kube/config」 write successful!
+------------+---------+-----------------------+--------------------+-----------------------------------+--------------+
| CURRENT | NAME | CLUSTER | USER | SERVER | Namespace |
+============+=========+=======================+====================+===================================+==============+
| | cd | cluster-chh6kgf9d9 | user-chh6kgf9d9 | https://cls-l6whmzi3.ccs.tence | default |
| | | | | nt-cloud.com | |
+------------+---------+-----------------------+--------------------+-----------------------------------+--------------+

Learn More

Ajuda e Suporte

Esta página foi útil?

comentários