kubernetes学习笔记(三)多集群切换

~/.kube/config

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data:
    server: https://192.168.26.31:6443
  name: cluster1
- cluster:
    certificate-authority-data:
    server: https://192.168.26.10:6443
  name: cluster2
contexts:
- context:
    cluster: cluster1
    user: kubernetes-admin1
  name: kubernetes-admin1@kubernetes1
- context:
    cluster: cluster2
    user: kubernetes-admin2
  name: kubernetes-admin2@kubernetes2
current-context: kubernetes-admin1@kubernetes1
kind: Config
preferences: {}
users:
- name: kubernetes-admin1
  user:
    client-certificate-data:
    client-key-data:
- name: kubernetes-admin2
  user:
    client-certificate-data: 
    client-key-data: 

kubectl config get-contexts

kubectl config use-context kubernetes-admin2@kubernetes2

你可能感兴趣的:(Kubernetes)