I have two GKE clusters: c1, c2,
我有两个GKE集群:c1,c2,
I use gcloud config set container/cluster c1
to set the default cluster to c1, after that I run kubectl run
, seems the new pods still created in c2.
我使用gCloud配置设置容器/集群c1将默认集群设置为c1,之后我运行kubectl run,似乎新的pod仍然在c2中创建。
how can i switch to c2? and what is the purpose of gcloud config set container/cluster cluster_name
?
我怎么才能换成c2?GCloud配置集CONTAINER/CLUSTER CLUSTER_NAME有什么作用?
更多回答
优秀答案推荐
The gcloud container cluster
commands are for administrating your clusters from a GCP perspective, e.g. adding another node-pool for a GKE kubernetes cluster using the node-pools create command.
GCloud容器集群命令用于从GCP的角度管理集群,例如使用node-pools create命令为GKE Kubernetes集群添加另一个节点池。
Controlling which cluster is used for kubectl is done via .kube/config file which has a so called current-context
. There is the kubectx/kubens project that provides some nice helpers to allow switching between clusters (and namespaces) more easily.
控制哪个集群用于kubectl是通过.kube/config文件完成的,该文件具有所谓的当前上下文。有一个kubectx/kubens项目,它提供了一些很好的助手,可以更轻松地在集群(和名称空间)之间切换。
If you have multiple clusters, you can set a default cluster for the kubectl command-line tool.
如果您有多个集群,您可以为kubectl命令行工具设置默认集群。
To set a default cluster for gcloud commands, run the following command:
要为gCloud命令设置默认群集,请运行以下命令:
gcloud config set container/cluster CLUSTER_NAME
GCloud配置设置容器/集群集群名称
更多回答
我是一名优秀的程序员,十分优秀!