kubernetes 多集群切换配置
2019-04-01 本文已影响0人
条子在洗澡
集群信息
集群1:
master :192.168.199.130
node1: 192.168.199.131
node2: 192.168.199.132
集群2:
master :192.168.199.140
node1: 192.168.199.141
node2: 192.168.199.142
编辑配置文件
#master1原配置文件 /root/.kube/config 内容如下
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRFNU1ETXpNREF4TkRnd05Gb1hEVEk1TURNeU56QXhORGd3TkZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTDV0Ck0yNTlPZ2NKMkNMRy9QdnRRRlBhMzByWTlOVUh1QVFhenN6ZFpucWZ1TGNNUmtDeDRDVklHaVR6c1JZUFFvVE8KbzhucDJwNThScitpSHQvRHVWZHBBUm5ER05JcktVL2h5UDNCQUVmTCtHVG5nT0tDRlJSMnVsMUlKMFFrYUxtVgozNTYrK1dGdktRY0p1ajBZcDFSWVFtcU53MVE5T0trREt6S1B1MFFFQmdMcmZwZHludmxZYmx5NUNZRUNNVG9NCnU3T2VKYXJFa01mL29aSXlwaEdNSSs5NTN1emplbnBaQ0JxV21NVGRZcmhPaGdTV05sTUlBMG5LQkJoSnQ1SFQKdzZQT0JkckpSL2NiQitEdVM4YlhES2JLUUdLVWlsV0d6MWoyS1JXdm5aSmtHQ0dwS2J5Nmp4WnR2KzlwNDBsMwpmdndaam5aQ01hTEFMZmd2NGFjQ0F3RUFBYU1qTUNFd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFCWXlMYk1oMkVVZ0J4TzExYTErYlR5c1pLWVEKR0x2MENpZ2t2MFFhQzZJaGFwVGc0Nm1xZ0pLOHRoSFJ6N0Jjck44V1JyazZxZWNKMFMyc0NtWXNKQ1FhRThVTApMa3NCODhLd0JhS1ZoaDFMV2NpbnZwakhJcjFmRWhNTU1YRjhQWHRra0JzNlBpQ2h5anpZNUphdmQrbWl3enJNCjBtQ0VVM3FJTjJlQ2tqU3JESURSWVFvZy8zc0RneGZBeWpJU0J6UC9vVUFpdDdZZk9TNExiTm0xa25BQ2VsQ2IKYmRTc2Nab2xVTEZyRWxvdlA5Q0tReHBKZ2NLWmw4bW9qSGxMeXV3blBDdTRDOFRNNlQrUkVVS1o3ZFNlUytSOApDZ0l5MTFJWnZYcFRPOFBhWnNEZllRQ1I3OXV5ejZrRk4zalBWN0lLNCtoZURSaWlNRW1LZHVQa1ljYz0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
server: https://192.168.199.130:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJS2Y0eXR6dmdjRjB3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB4T1RBek16QXdNVFE0TURSYUZ3MHlNREF6TWprd01UUTRNVGRhTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXoxNUxrZHJuWWhJbEZySzcKZmRpYTBEOG9tem94bDVKTGNjRlRvdUhMSnBBN01ZZCsw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ZBTW13Q1FQeEgKQWI3cnI0NzJxUW9qRFpqR3dtMm1qQUhFWE9CciszNnFhbmxiZTZvWVdiNU56UGs0ZDN6U2QrM2dsN0toR2JrUApYUys1UytEai9rSWFGaG44bWtac21Sd3J5VTJ2bW4zM1VxZTcxM3Y5ZVhXRDdNWUExMG9NUzMwaEtwN3UvM3czCjJzU0tVTEZrY3BZb0RWYTcvY1RCbDRHQUV1NXlKRTJudWV2SzZhYVJ4cHRKZDhpeXFSRHE4V2tXUUpLeFB0Wm8KaFZlZ2NUMGhlRVJEa2hVMFB4ZklXSzVuSWVDSEJaM2l4TUdZS3M4T2sxNjMrNlNUaEVsaWpOMUc0TkN3VkNHWgpwbmJMZDJZYVVjRGNWV3owK2NVblVEZTNTRDRFRmt3YTJvMFlmQkhYUzd6dnZxdndyVGJiNklHeHpuUT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
server: https://192.168.199.140:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJSU4vK2h4TVAzWWN3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB4T1RBek16RXdNREV4TWpKYUZ3MHlNREF6TXpBd01ERXhNek5hTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQTdIWWhGdndmNlJnMTErWGwKZWJhRE44Q2tRc1hiT2wzV3hWS0dZTUhncXNXN0ZLRlZRRXhWVVdZbllOTHNhbm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BSc2d2TkFyZE4rVmFnaW1BSzhOCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
#先备份后修改master1的配置文件如下:
cd /root/.kube
cp /root/.kube/config /root/.kube/config.bak
vim /root/.kube/config
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRFNU1ETXpNREF4TkRnd05Gb1hEVEk1TURNeU56QXhORGd3TkZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTDV0Ck0yNTlPZ2NKMkNMRy9QdnRRRlBhMzByWTlOVUh1QVFhenN6ZFpucWZ1TGNNUmtDeDRDVklHaVR6c1JZUFFvVE8KbzhucDJwNThScitpSHQvRHVWZHBBUm5ER05JcktVL2h5UDNCQUVmTCtHVG5nT0tDRlJSMnVsMUlKMFFrYUxtVgozNTYrK1dGdktRY0p1ajBZcDFSWVFtcU53MVE5T0trREt6S1B1MFFFQmdMcmZwZHludmxZYmx5NUNZRUNNVG9NCnU3T2VKYXJFa01mL29aSXlwaEdNSSs5NTN1emplbnBaQ0JxV21NVGRZcmhPaGdTV05sTUlBMG5LQkJoSnQ1SFQKdzZQT0JkckpSL2NiQitEdVM4YlhES2JLUUdLVWlsV0d6MWoyS1JXdm5aSmtHQ0dwS2J5Nmp4WnR2KzlwNDBsMwpmdndaam5aQ01hTEFMZmd2NGFjQ0F3RUFBYU1qTUNFd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFCWXlMYk1oMkVVZ0J4TzExYTErYlR5c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WFQwMHQ3LzNvdkFLc1pkdkRjZ3VwZEtJCjlaTVJ4Y1BJTkhRc2xyMUVXNXBIcE5GbUdkaE5mNnQ1YjV1M1VDOHRyaElXbW5DYTVEZU5EQk9KMC9aVGk2aHcKc0V6TW1aMkNmSjJvb0Vad0VXcDk3b1NWSFJRbFUxVFpFNUFIS20xT0NTdGs1S1YrczBuT2JiMmFHdVM1SENGZgo5UUJCcDBHaWxXUnhTOHFURXBVQ0F3RUFBYU1qTUNFd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFIK3NIWGRReDMwZXgrWVh4aVZBTW13Q1FQeEgKQWI3cnI0NzJxUW9qRFpqR3dtMm1qQUhFWE9CciszNnFhbmxiZTZvWVdiNU56UGs0ZDN6U2QrM2dsN0toR2JrUApYUys1UytEai9rSWFGaG44bWtac21Sd3J5VTJ2bW4zM1VxZTcxM3Y5ZVhXRDdNWUExMG9NUzMwaEtwN3UvM3czCjJzU0tVTEZrY3BZb0RWYTcvY1RCbDRHQUV1NXlKRTJudWV2SzZhYVJ4cHRKZDhpeXFSRHE4V2tXUUpLeFB0Wm8KaFZlZ2NUMGhlRVJEa2hVMFB4ZklXSzVuSWVDSEJaM2l4TUdZS3M4T2sxNjMrNlNUaEVsaWpOMUc0TkN3VkNHWgpwbmJMZDJZYVVjRGNWV3owK2NVblVEZTNTRDRFRmt3YTJvMFlmQkhYUzd6dnZxdndyVGJiNklHeHpuUT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
server: https://192.168.199.140:6443
name: chengdu_cluster2
contexts:
- context:
cluster: chengdu_cluster1
user: kubernetes-admin1
name: main_cluster
- context:
cluster: chengdu_cluster2
user: kubernetes-admin2
name: back_cluster
current-context: chengdu_cluster1
kind: Config
preferences: {}
users:
- name: kubernetes-admin1
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FUR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
#查看集群环境
[root@k8s-master1 .kube]# kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
back_cluster chengdu_cluster2 kubernetes-admin2
* main_cluster chengdu_cluster1 kubernetes-admin1
#切换到集群back_cluster
[root@k8s-master1 .kube]# kubectl config use-context back_cluster
Switched to context "back_cluster".
[root@k8s-master1 .kube]# kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* back_cluster chengdu_cluster2 kubernetes-admin2
main_cluster chengdu_cluster1 kubernetes-admin1