一、准备不同集群config配置文件
1、dev环境config配置文件
cat ~/.kube/config-dev
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: xxxxxx
server: https://192.168.86.36:6443
name: dev-cluster #(01 修改集群名称)
contexts:
- context:
cluster: dev-cluster #(01 修改集群名称)
user: dev-admin #(02 修改用户名称)
name: dev #(03 修改环境名称)
current-context: dev #(03 修改环境名称)
kind: Config
preferences: {}
users:
- name: dev-admin #(02 修改用户名称)
user:
client-certificate-data: xxxxxx
client-key-data: xxxxxx
2、prod环境config配置文件
cat ~/.kube/config-prod
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: xxxxxx
server: https://192.168.86.51:6443
name: prod-cluster #(01 修改集群名称)
contexts:
- context:
cluster: prod-cluster #(01 修改集群名称)
user: prod-admin #(02 修改用户名称)
name: prod