Kubernetes实战(十二)-使用kubeconfig文件管理多套kubernetes(k8s)集群

1 概述

在生产环境中可能不止有一套kubernetes(k8s)集群,面对多套集群,运维人员可以使用kubeconfig文件管理多套kubernetes(k8s)集群,使用 kubeconfig 文件,可以组织集群、用户和命名空间,还可以定义上下文,以便在集群和命名空间之间快速轻松地切换。

2 kubeconfig文件

用于配置集群访问的文件称为“kubeconfig 文件”。 这是引用配置文件的通用方法,并不意味着有一个名为 kubeconfig 的文件。

使用 kubeconfig 文件来组织有关集群、用户、命名空间和身份认证机制的信息。 kubectl 命令行工具使用 kubeconfig 文件来查找选择集群所需的信息,并与集群的 API 服务器进行通信。

默认情况下,kubectl 在 $HOME/.kube 目录下查找名为 config 的文件。 你可以通过设置 KUBECONFIG 环境变量或者设置 --kubeconfig参数来指定其他 kubeconfig 文件。

kubeconfig文件由3部分组成:clusters,users,contexts。clusters是kubernetes(k8s)集群信息,users是连接kubernetes(k8s)集群的用户信息,contexts上下文综合了clusters信息和users信息。

apiVersion: v1
clusters:
- cluster:certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM1ekNDQWMrZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJek1USXhNVEV6TVRVeE5Wb1hEVE16TVRJd09ERXpNVFV4TlZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTkdaCmR5N0J6Q1ZOYVZmeXJvN1k3Qm1JZ2lla3ZtSWpjUFpUdWp1UXlNMk43clZiQS9IcWh2eGQ2cmZtczM5a2IvSnYKOVpScWp5MUlGRTdsc3B5L1ZyL2F5TEYyMG0waDdsQnRTMlRrUXVHRkRzTUtQVWFsNVZIeU1rU05jbHd3NlpQVQpIMGhmSUZibHVlc2lxeTZBMlFad1NQT2FmZ3BGMmRyb2hFY242M0RiMzc0end3eERqVmRyS2g3cjF2RU85c0J6CjBkVGQ4UHVZdVFmL1R4ckk2M3JITFJRekViWXV0b3dlUzA0bTJKbUF1d2Y3bFVmQ3B4clNLWDlhb3FqRWZzTzEKN3U0Q3UvTG9kM2FENVFSZEJpeGNtdEYyeUV4VC9yaHgzckV5MDk3eHU5YzlVQVh0UVlxSXpTWTFLdTkvY1ZYUwozWkQ1MWtWR29RVVBMMU5WMHFFQ0F3RUFBYU5DTUVBd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0hRWURWUjBPQkJZRUZGb2N1RENoSUZjWmw2QmE0dTVQL0FUVnprOGJNQTBHQ1NxR1NJYjMKRFFFQkN3VUFBNElCQVFCMytBSitEa0hRa1IyOGJtYi9jbDA5WGtBQm0xdXE0cnVHTGVyazVIYUFWVnZWSThIVApiU3ByVWtXQno4OFJJa0JQQTNRdkNwUEt5YjdhbVk3QnpUekc4bmgwVGdUZXpoc2tWVjVoalc3VEYxSVp4WlhBCllCOThiQ0h6Zlo4ZUpoOW9DYjZKSkkyTUczYVVoN2pmZENsaHUzVUwvbGI3L0I5U0M3K2FFTUVJZHFPM0xydVkKbnZQRnVNeWpmdEhoNmVrY2x6VWptcGRtRFhLV3UzRExtYmRLWFg0TXpVRDNuSHkxWTdrekJISjJFUmpRbXlycgptSHh5c09vb2I4d1RIYmtQaFNic0x0ZVlDWFRER0tsd05OUytkSks4UVZjMTc4SFlURXJ1d3FYY2FRYkpFc1lICnBacGtDQ1lwRGJLMmp6Z0UzVnRFWnhCSkw5UW56dXV5eWVZaAotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==server: https://10.220.43.203:6443name: kubernetes
contexts:
- context:cluster: kubernetesuser: kubernetes-adminname: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-adminuser:client-certificate-data: LS0tLS1C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jWENRNG1NTDdEeFV3MUdhQXhQQlBQdVpWCmJxbWpnNTNRRlpNVUdnNGxKSHVDNmVrQ2dZRUF6Ry9KeWZqa282bkVGSHBFY2ZMN3hvVTg2NTEveENUMmVjNnQKYXVnZWJjYmhObTUwSjJRRkxLZUdQZzFrcnJNaHhYV2YxZno1MDRFdzBPVmJnWE9nckNndVBPMzRXT2loeXRLZgpmdXBuVDdxdGRUQUhaZ0ZVTGQxbmJwQjhiL3duR2Z5Qmk0RlRyb1NGcjlRb01oeW9jTmhyUUd2NGUrSStBTzVxCjg2NXlpVlVDZ1lFQXN1QWtlL01nMndKMnhLUzhWdE9rUHArSGpReVhFeW9mM09STGRPSEtXcFFoZzl0WGdZZjUKRmJVVW1WME5KQ3RqUm9tMnkrRHk1bCtsSTQ3UjlBWkRLRHVYTTg4b2NIY1FkR0FhdjZ3c1JMSmpmbkpsaVU3bgp5WFhZaVVVZUQyaUljVTlFa25aZU14MGVIQkFvOEdPQ3hWakZlWEl5ODF6aHNkN3BqZnNJWDhVPQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=

3 kubernetes(k8s)多集群切换 

默认的kubeconfig文件为:~/.kube/config 文件。

$ ls .kube/
cache  config

编写一个kubeconfig文件来管理两套k8s集群。

$ cp .kube/config config2
$ cat config2 
apiVersion: v1
clusters:
- cluster:certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM1ekNDQWMrZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeU1ERXdPVEE0TVRnd01Wb1hEVE15TURFd056QTRNVGd3TVZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTEZyCkRxb2YyV2twdDJ1a2xSWnljRHQyQ2xmYnNX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otLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==server: https://192.168.110.130:6443name: cluster1
- cluster:certificate-authority-data:这里写第二个集群的密钥 server: https://cluster2_ip:6443name: cluster2
contexts:
- context:cluster: cluster1namespace: defaultuser: admin1name: admin1@cluster1
- context:cluster: cluster2namespace: defaultuser: admin2name: admin2@cluster2
current-context: admin1@cluster1
kind: Config
preferences: {}
users:
- name: admin1user:client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQWdtZ0F3SUJBZ0lJR0ZpNStHUTdGOGd3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TWpBeE1Ea3dPREU0TURGYUZ3MHlNekF4TURrd09ERTRNRE5hTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXNMUVpScS9BeVF1aDlVdy8KN0craVJqekovdUFjbmtubU9VMHQ1OHNIcUw4b0ZXVlFyeUlDS3djdEtMcEp6RHBMOEZDWUtoejJSekY2VHJtawpzYVcvT2FMRmV2SjR2Y2NIbm1McGR1SWpram1TRnJ0L0R6VCsvSWdacGNlL21SRC9LR0tQUUxSQVVpUGx6NzdhClRvYU1pWGM5Ny9XZGp0Nk9ic091RGVsTnlteU4xRG5ONWJ2NWRFTkRaclh3VTFkQndhQjRXdnliTi9nVm02TUUKSjhRdXJDZ2V5d2swRjRtd3kwcGUyVldBd3Y1VHFxTmVzZ01pWHFacjZ2SjNSV285Z0tCeVhCODNBb1gwTlk4TQptY1JIWG44cWhPZ3hYTXhXUWM2SEI1cE81QnFPUnY3MUE0NC9tU1FoWkNORCtLdVhPVlQvUmMvRTU1eDBpWjZoCmVrcHo0UUlEQVFBQm8x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Fva3NICjlYUEhyOFFqWXJkYWpSVnlkUDhaL0hycGdIRGYxckNOVGtXVjBZcExBb0dBSWFqUWN5WkZURnpKeWRzZ1Z2eVYKUjNpYjIwUXUzQ2Vrd0JoblRwaGNvY0dDNGlLNjBLcGZ0S01xRG1mbEdYVm5GU05HTkNNVENXQ0pkK0d0cDZOKwpNTFhIT3BuUDcydjdlN3RZTDZHY1dxYW1XbjMxbFVpUnNIMTRtYmg3T3ZJeWhDL2VuMjkxTWNqU1YydFFNWVZTCkpjSFh3a0pkVXJ5WXpBQS9IYWhNckVrQ2dZRUFoN3V1WjBrcXFUdmxEY3BzaE1pWmhSbGhwNDZSL2srdWtLbVcKTjJITlk1WGVUdFFDVnhpN3hxQWdLOEN3U0hWSC84YkdUZzFFZ3dnRHB5VURXcEJ1enhBNS9TWlQ3a1Q4OFhvKwptM05CcDZBNE82OUVaU2lvUDFoQndoUHdzT3RwK25hSDdpb0QxNDBMZXh0Q29UdjJqSk5LaEVsL3lEVUdidmEyCklqQmNwbjBDZ1lCZThNTERFK1RCKytYVHFUT29wWGhaL09vRVdlSEp2M2xwdGdmOWg0eVZja3NqVEtNMkpKcEsKNFJFYmJSdUdsY1hOUzg3bEh1dUtCZE9aVzR5Q1hMTCtzcGt4YkY0ZmlFQWFkaTFDOWhZSko3Y2kzZy9jdUxLcQpPdk9EdlhBK2dlRHVaMk9Gakh6RU1XcktKUm1Sd0N1QVdqRld5WndneU16dUp4WWRkRU1raWc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=
- name: admin2user:client-certificate-data:这里写第二个集群的用户公钥 client-key-data:这里写第二个集群的用户私钥

查看全局上下文,看有几套集群。

$ kubectl config get-contexts 
CURRENT   NAME                          CLUSTER      AUTHINFO           NAMESPACE
*         kubernetes-admin@kubernetes   kubernetes   kubernetes-admin   

切换k8s集群。

$ kubectl config use-context kubernetes-admin@kubernetes
Switched to context "kubernetes-admin@kubernetes".

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/267064.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

大数据驱动下的人口普查:新时代下的新变革

人口普查数据大屏,是指一种通过大屏幕显示人口普查数据的设备,可以将人口普查数据以可视化的形式呈现出来,为决策者提供直观、准确的人口数据。这种大屏幕的出现,让人口普查数据的利用变得更加高效、便捷。 如果您需要制作一张直观…

ubuntu解决问题:E: Unable to locate package manpages-posix-dev

sudo apt-get install manpages-posix-dev 想要在ubuntu里面安装manpages-posix-dev这个包,发现弹出错误 E: Unable to locate package manpages-posix-dev 解决方法如下: 1 查看当前ubuntu的版本 abhishekitsfoss:~$ lsb_release -a No LSB module…

ChatGPT/GPT4应用:文本、论文、编程、绘图等,提高工作效率及科研项目开发能力

2023年随着OpenAI开发者大会的召开,最重磅更新当属GPTs,多模态API,未来自定义专属的GPT。微软创始人比尔盖茨称ChatGPT的出现有着重大历史意义,不亚于互联网和个人电脑的问世。360创始人周鸿祎认为未来各行各业如果不能搭上这班车…

泛微e-cology XmlRpcServlet文件读取漏洞复现

0x01 产品简介 泛微e-cology是专为大中型企业制作的OA办公系统,支持PC端、移动端和微信端同时办公等。 0x02 漏洞概述 泛微e-cology XmlRpcServlet接口处存在任意文件读取漏洞,攻击者可通过该漏洞读取系统重要文件(如数据库配置文件、系统配置文件)、数据库配置文件等等,…

3.4.4SR窗口长度

1.发送方没有收到ack0导致接收端需求接受新0帧但是接收旧0帧(ack0丢失) 2.发送方滑动窗口右移两次发送新0接收端接收新0(正常情况) 这里视频讲解不是很清晰。。。 这里和GBN协议相区别

CIDR(无类域间路由)与VLSM(可变长度子网掩码)的区别

CIDR和VLSM的介绍 CIDR CIDR(Classless Inter-Domain Routing,无类域间路由)是一种用于对互联网协议(IP)地址进行聚合和分配的标准。CIDR的引入旨在解决IPv4地址空间的不足和低效分配的问题。在传统的IP地址规划中&a…

Plantuml之类图语法介绍(十六)

简介: CSDN博客专家,专注Android/Linux系统,分享多mic语音方案、音视频、编解码等技术,与大家一起成长! 优质专栏:Audio工程师进阶系列【原创干货持续更新中……】🚀 优质专栏:多媒…

Python-docx 深入word源码 自定义字符间距

代码和实现效果 from docx import Document from docx.oxml import OxmlElement from docx.oxml.ns import qn from docx.shared import Pt# 调整pt设置字间距 def SetParagraphCharSpaceByPt(run, pt1):通过修改word源码方式, 添加w:spacing标签直接通过调整pt来设置字符间距…

day45-46-Vue+ElementUI实现学生管理

VueElementUI实现学生管理 代码: qiushiju/java2313_vue_elementui_crud (gitee.com) 一、思考 考虑需求(登录,查询全部,基本增删改查,分页,搜索,批量) 设计数据库搭建项目 后端…

鸿蒙HarmonyOS4.0 入门与实战

一、开发准备: 熟悉鸿蒙官网安装DevEco Studio熟悉鸿蒙官网 HarmonyOS应用开发官网 - 华为HarmonyOS打造全场景新服务 应用设计相关资源: 开发相关资源: 例如开发工具 DevEco Studio 的下载 应用发布: 开发文档:

【C++练级之路】【Lv.3】类和对象(中)(没掌握类的6个默认成员函数,那你根本就没学过C++!)

目录 引言一、类的6个默认成员函数二、构造函数(constructor)2.1 引入2.2 概念2.3 特性 三、析构函数(destructor)3.1 概念3.2 特性 四、拷贝构造函数(copy constructor)4.1 概念4.2 特性 五、构造、析构、…

EDA 数字时钟

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 前言一、数字时钟是什么?二、EDA里面数码管的显示1.元件模型2.参考程序3. 实验仿真波形4.实验现象5. 仿真问题 三、显示时钟1. 时钟电路模块2.参考程序3…