From d284a75ef23a97b8d0c205f9dcd89f904b9c5b0d Mon Sep 17 00:00:00 2001 From: xin Date: Mon, 14 Dec 2020 17:01:31 +0800 Subject: [PATCH 1/3] Update authentication.md Fix typo --- content/zh/docs/reference/access-authn-authz/authentication.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/zh/docs/reference/access-authn-authz/authentication.md b/content/zh/docs/reference/access-authn-authz/authentication.md index 030a628860..b54ca2f148 100644 --- a/content/zh/docs/reference/access-authn-authz/authentication.md +++ b/content/zh/docs/reference/access-authn-authz/authentication.md @@ -351,7 +351,7 @@ talk to the API server. Accounts may be explicitly associated with pods using th 服务账号通常由 API 服务器自动创建并通过 `ServiceAccount` [准入控制器](/zh/docs/reference/access-authn-authz/admission-controllers/) 关联到集群中运行的 Pod 上。 -持有者令牌会挂载到 Pod 中可预知的为之,允许集群内进程与 API 服务器通信。 +持有者令牌会挂载到 Pod 中可预知的位置,允许集群内进程与 API 服务器通信。 服务账号也可以使用 Pod 规约的 `serviceAccountName` 字段显式地关联到 Pod 上。 + +该插件可以选择使用环境变量`KUBERNETES_EXEC_INFO`进行调用, +该变量包含了此插件获取凭据的集群信息。此信息可用于执行群集特定的凭据获取逻辑。为了启用此行为,必须在 [kubeconfig](/zh/docs/concepts/configuration/organize-cluster-access-kubeconfig/)中的 exec 用户字段上设置`provideClusterInfo`字段。下面是上述`KUBERNETES_EXEC_INFO`环境变量的示例。 + +```json +{ + "apiVersion": "client.authentication.k8s.io/v1beta1", + "kind": "ExecCredential", + "spec": { + "cluster": { + "server": "https://172.17.4.100:6443", + "certificate-authority-data": "LS0t...", + "config": { + "arbitrary": "config", + "this": "can be provided via the KUBERNETES_EXEC_INFO environment variable upon setting provideClusterInfo", + "you": ["can", "put", "anything", "here"] + } + } + } +} +``` \ No newline at end of file From dfea17333265914887371563967d3f4f31738561 Mon Sep 17 00:00:00 2001 From: xin Date: Tue, 15 Dec 2020 14:03:23 +0800 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Qiming Teng --- .../access-authn-authz/authentication.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/content/zh/docs/reference/access-authn-authz/authentication.md b/content/zh/docs/reference/access-authn-authz/authentication.md index d72e8e9d2b..bd3aa07909 100644 --- a/content/zh/docs/reference/access-authn-authz/authentication.md +++ b/content/zh/docs/reference/access-authn-authz/authentication.md @@ -1454,7 +1454,7 @@ users: # 当可执行文件不存在时显示给用户的文本。可选的。 installHint: | - 需要example-client-go-exec-plugin来验证当前集群。可以通过以下命令安装: + 需要 example-client-go-exec-plugin 来在当前集群上执行身份认证。可以通过以下命令安装: MacOS: brew install example-client-go-exec-plugin @@ -1464,7 +1464,8 @@ users: ... - # 是否向这个 exec 插件提供集群信息(可能包含非常大的CA数据),作为KUBERNETES_EXEC_INFO环境变量的一部分。 + # 是否使用 KUBERNETES_EXEC_INFO 环境变量的一部分向这个 exec 插件 + # 提供集群信息(可能包含非常大的 CA 数据) provideClusterInfo: true clusters: - name: my-cluster @@ -1475,7 +1476,7 @@ clusters: - name: client.authentication.k8s.io/exec # 为每个集群 exec 配置保留的扩展名 extension: arbitrary: config - this: can be provided via the KUBERNETES_EXEC_INFO environment variable upon setting provideClusterInfo + this: 在设置 provideClusterInfo 时可通过环境变量 KUBERNETES_EXEC_INFO 指定 you: ["can", "put", "anything", "here"] contexts: - name: my-cluster @@ -1607,8 +1608,11 @@ be set on the exec user field in the example of the aforementioned `KUBERNETES_EXEC_INFO` environment variable. --> -该插件可以选择使用环境变量`KUBERNETES_EXEC_INFO`进行调用, -该变量包含了此插件获取凭据的集群信息。此信息可用于执行群集特定的凭据获取逻辑。为了启用此行为,必须在 [kubeconfig](/zh/docs/concepts/configuration/organize-cluster-access-kubeconfig/)中的 exec 用户字段上设置`provideClusterInfo`字段。下面是上述`KUBERNETES_EXEC_INFO`环境变量的示例。 +调用此插件时可以选择性地设置环境变量 `KUBERNETES_EXEC_INFO`。 +该变量包含了此插件获取凭据所针对的集群信息。此信息可用于执行群集特定的凭据获取逻辑。 +为了启用此行为,必须在 [kubeconfig](/zh/docs/concepts/configuration/organize-cluster-access-kubeconfig/) +中的 exec user 字段上设置`provideClusterInfo`字段。 +下面是上述 `KUBERNETES_EXEC_INFO` 环境变量的示例。 ```json { @@ -1620,10 +1624,10 @@ example of the aforementioned `KUBERNETES_EXEC_INFO` environment variable. "certificate-authority-data": "LS0t...", "config": { "arbitrary": "config", - "this": "can be provided via the KUBERNETES_EXEC_INFO environment variable upon setting provideClusterInfo", + "this": "在设置 provideClusterInfo 时可通过环境变量 KUBERNETES_EXEC_INFO 指定", "you": ["can", "put", "anything", "here"] } } } } -``` \ No newline at end of file +```