zh: add content_zh/boilerplates/kubectl-multicluster-contexts.md (#3649)

This commit is contained in:
SataQiu 2019-03-12 21:22:36 +08:00 committed by istio-bot
parent e44c7088a3
commit 3fd7ce5ef1
1 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,16 @@
* `kubectl` 能通过 `--context` 参数切换上下文,以支持对不同集群 `cluster1``cluster2` 的访问。
使用如下命令列出现存的上下文:
{{< text bash >}}
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* cluster1 cluster1 user@foo.com default
cluster2 cluster2 user@foo.com default
{{< /text >}}
* 使用配置的上下文名称导出以下环境变量:
{{< text bash >}}
$ export CTX_CLUSTER1=<KUBECONFIG_CONTEXT_NAME_FOR_CLUSTER_1>
$ export CTX_CLUSTER2=<KUBECONFIG_CONTEXT_NAME_FOR_CLUSTER_2>
{{< /text >}}