@@ -32,7 +32,7 @@ It does not mean that there is a file named `kubeconfig`.
3232
3333<!--
3434{{< warning >}}
35- Only use kubeconfig files from trusted sources. Using a specially-crafted kubeconfig file could result in malicious code execution or file exposure.
35+ Only use kubeconfig files from trusted sources. Using a specially-crafted kubeconfig file could result in malicious code execution or file exposure.
3636If you must use an untrusted kubeconfig file, inspect it carefully first, much as you would a shell script.
3737{{< /warning>}}
3838-->
@@ -96,15 +96,16 @@ clusters and namespaces.
9696A *context* element in a kubeconfig file is used to group access parameters
9797under a convenient name. Each context has three parameters: cluster, namespace, and user.
9898By default, the `kubectl` command-line tool uses parameters from
99- the *current context* to communicate with the cluster.
99+ the *current context* to communicate with the cluster.
100100-->
101101通过 kubeconfig 文件中的 * context* 元素,使用简便的名称来对访问参数进行分组。每个上下文都有三个参数:cluster、namespace 和 user。默认情况下,` kubectl ` 命令行工具使用 * 当前上下文* 中的参数与集群进行通信。
102102
103103<!--
104104To choose the current context:
105105-->
106106选择当前上下文
107- ```
107+
108+ ``` shell
108109kubectl config use-context
109110```
110111
@@ -175,7 +176,7 @@ Here are the rules that `kubectl` uses when it merges kubeconfig files:
175176 Even if the second file has non-conflicting entries under `red-user`, discard them.
176177-->
1771781 . 如果设置了 ` --kubeconfig ` 参数,则仅使用指定的文件。不进行合并。此参数只能使用一次。
178-
179+
179180 否则,如果设置了 ` KUBECONFIG ` 环境变量,将它用作应合并的文件列表。根据以下规则合并 ` KUBECONFIG ` 环境变量中列出的文件:
180181
181182 * 忽略空文件名。
@@ -280,6 +281,34 @@ kubeconfig 文件中的文件和路径引用是相对于 kubeconfig 文件的位
280281命令行上的文件引用是相对于当前工作目录的。
281282在 ` $HOME/.kube/config ` 中,相对路径按相对路径存储,绝对路径按绝对路径存储。
282283
284+ <!--
285+ ## Proxy
286+
287+ You can configure `kubectl` to use proxy by setting `proxy-url` in the kubeconfig file, like:
288+ -->
289+ ## 代理
290+
291+ 你可以在 ` kubeconfig ` 文件中设置 ` proxy-url ` 来为 ` kubectl ` 使用代理,例如:
292+
293+ ``` yaml
294+ apiVersion : v1
295+ kind : Config
296+
297+ proxy-url : https://proxy.host:3128
298+
299+ clusters :
300+ - cluster :
301+ name : development
302+
303+ users :
304+ - name : developer
305+
306+ contexts :
307+ - context :
308+ name : development
309+
310+ ```
311+
283312## {{% heading "whatsnext" %}}
284313
285314<!--
@@ -288,4 +317,3 @@ kubeconfig 文件中的文件和路径引用是相对于 kubeconfig 文件的位
288317--->
289318* [ 配置对多集群的访问] ( /zh/docs/tasks/access-application-cluster/configure-access-multiple-clusters/ )
290319* [ ` kubectl config ` ] ( /docs/reference/generated/kubectl/kubectl-commands#config )
291-
0 commit comments