A couple of days ago I am looking for a tool to manage different Kubernetes Clusters in my only laptop. But after a while, I realized that kubectl
actually support multi-clusters by itself (link).
Then I opened my .kube/config
file and saw
clusters:
- cluster:
name: ClusterA
- cluster:
name: ClusterB
users:
- user:
name: UserA
- user:
name: UserB
contexts:
- context:
cluster: ClusterA
user: UserA
name: ContextA
- context:
cluster: ClusterB
user: UserB
name: ContextB
current-context: ContextA
Seems that we could directly use argo
command to submit Argo workflow to different k8s clusters:
argo submit job_a.xml --context ContextA
argo submit job_b.xml --context ContextB
Since the context names are automatically generated by gcloud container clusters get-credentials <gke_cluster_name>
, what should I do if I want to make the name more intuitive?
The answer is here. We can just use:
kubectl config rename-context <old_context_name> <new_context_name>