Skip to content

Commit 95ff881

Browse files
authored
Merge pull request #43899 from my-git9/patch-28508
[zh-cn] sync kubectl authentication
2 parents f075259 + c6236fc commit 95ff881

File tree

2 files changed

+64
-42
lines changed

2 files changed

+64
-42
lines changed

content/zh-cn/docs/reference/access-authn-authz/authentication.md

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ To enable the plugin, configure the following flags on the API server:
547547
<!--
548548
| Parameter | Description | Example | Required |
549549
| --------- | ----------- | ------- | ------- |
550-
| `--oidc-issuer-url` | URL of the provider which allows the API server to discover public signing keys. Only URLs which use the `https://` scheme are accepted. This is typically the provider's discovery URL without a path, for example "https://accounts.google.com" or "https://login.salesforce.com". This URL should point to the level below .well-known/openid-configuration | If the discovery URL is `https://accounts.google.com/.well-known/openid-configuration`, the value should be `https://accounts.google.com` | Yes |
550+
| `--oidc-issuer-url` | URL of the provider that allows the API server to discover public signing keys. Only URLs that use the `https://` scheme are accepted. This is typically the provider's discovery URL, changed to have an empty path | If the issuer's OIDC discovery URL is `https://accounts.provider.example/.well-known/openid-configuration`, the value should be `https://accounts.google.com` | Yes |
551551
| `--oidc-client-id` | A client id that all tokens must be issued for. | kubernetes | Yes |
552552
| `--oidc-username-claim` | JWT claim to use as the user name. By default `sub`, which is expected to be a unique identifier of the end user. Admins can choose other claims, such as `email` or `name`, depending on their provider. However, claims other than `email` will be prefixed with the issuer URL to prevent naming clashes with other plugins. | sub | No |
553553
| `--oidc-username-prefix` | Prefix prepended to username claims to prevent clashes with existing names (such as `system:` users). For example, the value `oidc:` will create usernames like `oidc:jane.doe`. If this flag isn't provided and `--oidc-username-claim` is a value other than `email` the prefix defaults to `( Issuer URL )#` where `( Issuer URL )` is the value of `--oidc-issuer-url`. The value `-` can be used to disable all prefixing. | `oidc:` | No |
@@ -560,7 +560,7 @@ To enable the plugin, configure the following flags on the API server:
560560

561561
| 参数 | 描述 | 示例 | 必需? |
562562
| --------- | ----------- | ------- | ------- |
563-
| `--oidc-issuer-url` | 允许 API 服务器发现公开的签名密钥的服务的 URL。只接受模式为 `https://` 的 URL。此值通常设置为服务的发现 URL,不含路径。例如:"https://accounts.google.com" 或 "https://login.salesforce.com"。此 URL 应指向 .well-known/openid-configuration 下一层的路径。 | 如果发现 URL 是 `https://accounts.google.com/.well-known/openid-configuration`,则此值应为 `https://accounts.google.com` | 是 |
563+
| `--oidc-issuer-url` | 允许 API 服务器发现公开的签名密钥的服务的 URL。只接受模式为 `https://` 的 URL。此值通常设置为服务的发现 URL,已更改为空路径。 | 如果发行人的 OIDC 发现 URL 是 `https://accounts.google.com/.well-known/openid-configuration`,则此值应为 `https://accounts.google.com` | 是 |
564564
| `--oidc-client-id` | 所有令牌都应发放给此客户 ID。 | kubernetes | 是 |
565565
| `--oidc-username-claim` | 用作用户名的 JWT 申领(JWT Claim)。默认情况下使用 `sub` 值,即最终用户的一个唯一的标识符。管理员也可以选择其他申领,例如 `email` 或者 `name`,取决于所用的身份服务。不过,除了 `email` 之外的申领都会被添加令牌发放者的 URL 作为前缀,以免与其他插件产生命名冲突。 | sub | 否 |
566566
| `--oidc-username-prefix` | 要添加到用户名申领之前的前缀,用来避免与现有用户名发生冲突(例如:`system:` 用户)。例如,此标志值为 `oidc:` 时将创建形如 `oidc:jane.doe` 的用户名。如果此标志未设置,且 `--oidc-username-claim` 标志值不是 `email`,则默认前缀为 `<令牌发放者的 URL>#`,其中 `<令牌发放者 URL >` 的值取自 `--oidc-issuer-url` 标志的设定。此标志值为 `-` 时,意味着禁止添加用户名前缀。 | `oidc:` | 否 |
@@ -746,7 +746,7 @@ Webhook 身份认证是一种用来验证持有者令牌的回调机制。
746746
* `--authentication-token-webhook-cache-ttl` 用来设定身份认证决定的缓存时间。
747747
默认时长为 2 分钟。
748748
* `--authentication-token-webhook-version` 决定是使用 `authentication.k8s.io/v1beta1` 还是
749-
`authenticationk8s.io/v1` 版本的 `TokenReview` 对象从 webhook 发送/接收信息。
749+
`authenticationk8s.io/v1` 版本的 `TokenReview` 对象从 Webhook 发送/接收信息。
750750
默认为“v1beta1”。
751751

752752
<!--
@@ -1095,7 +1095,7 @@ the risks and the mechanisms to protect the CA's usage.
10951095
-->
10961096
为了防范头部信息侦听,在请求中的头部字段被检视之前,
10971097
身份认证代理需要向 API 服务器提供一份合法的客户端证书,供后者使用所给的 CA 来执行验证。
1098-
警告:**不要** 在不同的上下文中复用 CA 证书,除非你清楚这样做的风险是什么以及应如何保护
1098+
警告:**不要**在不同的上下文中复用 CA 证书,除非你清楚这样做的风险是什么以及应如何保护
10991099
CA 用法的机制。
11001100

11011101
* `--requestheader-client-ca-file` 必需字段,给出 PEM 编码的证书包。
@@ -1172,11 +1172,11 @@ to the impersonated user info.
11721172
带伪装的请求首先会被身份认证识别为发出请求的用户,
11731173
之后会切换到使用被伪装的用户的用户信息。
11741174

1175-
* 用户发起 API 调用时 **同时** 提供自身的凭据和伪装头部字段信息
1176-
* API 服务器对用户执行身份认证
1177-
* API 服务器确认通过认证的用户具有伪装特权
1178-
* 请求用户的信息被替换成伪装字段的值
1179-
* 评估请求,鉴权组件针对所伪装的用户信息执行操作
1175+
* 用户发起 API 调用时**同时**提供自身的凭据和伪装头部字段信息
1176+
* API 服务器对用户执行身份认证
1177+
* API 服务器确认通过认证的用户具有伪装特权
1178+
* 请求用户的信息被替换成伪装字段的值
1179+
* 评估请求,鉴权组件针对所伪装的用户信息执行操作
11801180

11811181
<!--
11821182
The following HTTP headers can be used to performing an impersonation request:
@@ -1283,7 +1283,7 @@ authorization plugin, the following ClusterRole encompasses the rules needed to
12831283
set user and group impersonation headers:
12841284
-->
12851285
若要伪装成某个用户、某个组、用户标识符(UID))或者设置附加字段,
1286-
执行伪装操作的用户必须具有对所伪装的类别(user”、“group”、“uid 等)执行 impersonate
1286+
执行伪装操作的用户必须具有对所伪装的类别(`user`、`group`、`uid` 等)执行 `impersonate`
12871287
动词操作的能力。
12881288
对于启用了 RBAC 鉴权插件的集群,下面的 ClusterRole 封装了设置用户和组伪装字段所需的规则:
12891289

@@ -1706,7 +1706,7 @@ users:
17061706
provideClusterInfo: true
17071707
17081708
# Exec 插件与标准输入 I/O 数据流之间的协议。如果协议无法满足,
1709-
# 则插件无法运行并会返回错误信息。合法的值包括 "Never" (Exec 插件从不使用标准输入),
1709+
# 则插件无法运行并会返回错误信息。合法的值包括 "Never"(Exec 插件从不使用标准输入),
17101710
# "IfAvailable" (Exec 插件希望在可以的情况下使用标准输入),
17111711
# 或者 "Always" (Exec 插件需要使用标准输入才能工作)。可选字段。
17121712
# 默认值为 "IfAvailable"。
@@ -1853,7 +1853,7 @@ If specified, `clientKeyData` and `clientCertificateData` must both must be pres
18531853
如果插件在后续调用中返回了不同的证书或密钥,`k8s.io/client-go`
18541854
会终止其与服务器的连接,从而强制执行新的 TLS 握手过程。
18551855

1856-
如果指定了这种方式,则 `clientKeyData` 和 `clientCertificateData` 字段都必需存在
1856+
如果指定了这种方式,则 `clientKeyData` 和 `clientCertificateData` 字段都必须存在
18571857

18581858
`clientCertificateData` 字段可能包含一些要发送给服务器的中间证书(Intermediate
18591859
Certificates)。
@@ -1996,7 +1996,7 @@ The following `ExecCredential` manifest describes a cluster information sample.
19961996
-->
19971997
## 为客户端提供的对身份验证信息的 API 访问 {#self-subject-review}
19981998

1999-
{{< feature-state for_k8s_version="v1.27" state="beta" >}}
1999+
{{< feature-state for_k8s_version="v1.28" state="stable" >}}
20002000

20012001
<!--
20022002
If your cluster has the API enabled, you can use the `SelfSubjectReview` API to find out how your Kubernetes cluster maps your authentication information to identify you as a client. This works whether you are authenticating as a user (typically representing a real person) or as a ServiceAccount.
@@ -2015,12 +2015,12 @@ Kubernetes API 服务器收到请求后,将使用用户属性填充 status 字
20152015
请求示例(主体将是 `SelfSubjectReview`):
20162016

20172017
```
2018-
POST /apis/authentication.k8s.io/v1beta1/selfsubjectreviews
2018+
POST /apis/authentication.k8s.io/v1/selfsubjectreviews
20192019
```
20202020
20212021
```json
20222022
{
2023-
"apiVersion": "authentication.k8s.io/v1beta1",
2023+
"apiVersion": "authentication.k8s.io/v1",
20242024
"kind": "SelfSubjectReview"
20252025
}
20262026
```
@@ -2032,7 +2032,7 @@ Response example:
20322032

20332033
```json
20342034
{
2035-
"apiVersion": "authentication.k8s.io/v1beta1",
2035+
"apiVersion": "authentication.k8s.io/v1",
20362036
"kind": "SelfSubjectReview",
20372037
"status": {
20382038
"userInfo": {
@@ -2119,7 +2119,7 @@ By providing the output flag, it is also possible to print the JSON or YAML repr
21192119

21202120
{{% tab name="YAML" %}}
21212121
```yaml
2122-
apiVersion: authentication.k8s.io/v1alpha1
2122+
apiVersion: authentication.k8s.io/v1
21232123
kind: SelfSubjectReview
21242124
status:
21252125
userInfo:
@@ -2142,10 +2142,12 @@ status:
21422142
21432143
<!--
21442144
This feature is extremely useful when a complicated authentication flow is used in a Kubernetes cluster,
2145-
for example, if you use [webhook token authentication](/docs/reference/access-authn-authz/authentication/#webhook-token-authentication) or [authenticating proxy](/docs/reference/access-authn-authz/authentication/#authenticating-proxy).
2145+
for example, if you use [webhook token authentication](/docs/reference/access-authn-authz/authentication/#webhook-token-authentication)
2146+
or [authenticating proxy](/docs/reference/access-authn-authz/authentication/#authenticating-proxy).
21462147
-->
21472148
在 Kubernetes 集群中使用复杂的身份验证流程时,例如如果你使用
2148-
[Webhook 令牌身份验证](/zh-cn/docs/reference/access-authn-authz/authentication/#webhook-token-authentication)或[身份验证代理](/zh-cn/docs/reference/access-authn-authz/authentication/#authenticating-proxy)时,
2149+
[Webhook 令牌身份验证](/zh-cn/docs/reference/access-authn-authz/authentication/#webhook-token-authentication)或
2150+
[身份验证代理](/zh-cn/docs/reference/access-authn-authz/authentication/#authenticating-proxy)时,
21492151
此特性极其有用。
21502152
21512153
{{< note >}}
@@ -2162,7 +2164,8 @@ Kubernetes API 服务器在所有身份验证机制
21622164
{{< /note >}}
21632165

21642166
<!--
2165-
By default, all authenticated users can create `SelfSubjectReview` objects when the `APISelfSubjectReview` feature is enabled. It is allowed by the `system:basic-user` cluster role.
2167+
By default, all authenticated users can create `SelfSubjectReview` objects when the `APISelfSubjectReview` feature is enabled.
2168+
It is allowed by the `system:basic-user` cluster role.
21662169
-->
21672170
默认情况下,所有经过身份验证的用户都可以在 `APISelfSubjectReview` 特性被启用时创建 `SelfSubjectReview` 对象。
21682171
这是 `system:basic-user` 集群角色允许的操作。
@@ -2172,17 +2175,24 @@ By default, all authenticated users can create `SelfSubjectReview` objects when
21722175
You can only make `SelfSubjectReview` requests if:
21732176
* the `APISelfSubjectReview`
21742177
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
2175-
is enabled for your cluster (enabled by default after reaching Beta)
2178+
is enabled for your cluster (not needed for Kubernetes {{< skew currentVersion >}}, but older
2179+
Kubernetes versions might not offer this feature gate, or might default it to be off)
2180+
* (if you are running a version of Kubernetes older than v1.28) the API server for your
2181+
cluster has the `authentication.k8s.io/v1alpha1` or `authentication.k8s.io/v1beta1`
21762182
* the API server for your cluster has the `authentication.k8s.io/v1alpha1` or `authentication.k8s.io/v1beta1`
21772183
{{< glossary_tooltip term_id="api-group" text="API group" >}}
21782184
enabled.
21792185
-->
21802186
你只能在以下情况下进行 `SelfSubjectReview` 请求:
21812187

2182-
* 集群启用了 `APISelfSubjectReview` (Beta 版本默认启用)
2188+
* 集群启用了 `APISelfSubjectReview`
21832189
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
2190+
(Kubernetes {{< skew currentVersion >}} 不需要,但较旧的 Kubernetes 版本可能没有此特性门控,
2191+
或者默认为关闭状态)。
2192+
* (如果你运行的 Kubernetes 版本早于 v1.28 版本)集群的 API 服务器包含
2193+
`authentication.k8s.io/v1alpha1` 或 `authentication.k8s.io/v1beta1` API 组。
21842194
* 集群的 API 服务器已启用 `authentication.k8s.io/v1alpha1` 或者 `authentication.k8s.io/v1beta1`
2185-
{{< glossary_tooltip term_id="api-group" text="API 组" >}}。
2195+
{{< glossary_tooltip term_id="api-group" text="API 组" >}}。
21862196
{{< /note >}}
21872197

21882198
## {{% heading "whatsnext" %}}
@@ -2191,6 +2201,5 @@ You can only make `SelfSubjectReview` requests if:
21912201
* Read the [client authentication reference (v1beta1)](/docs/reference/config-api/client-authentication.v1beta1/)
21922202
* Read the [client authentication reference (v1)](/docs/reference/config-api/client-authentication.v1/)
21932203
-->
2194-
* 阅读[客户端认证参考文档 (v1beta1)](/zh-cn/docs/reference/config-api/client-authentication.v1beta1/)
2195-
* 阅读[客户端认证参考文档 (v1)](/zh-cn/docs/reference/config-api/client-authentication.v1/)
2196-
2204+
* 阅读[客户端认证参考文档(v1beta1)](/zh-cn/docs/reference/config-api/client-authentication.v1beta1/)。
2205+
* 阅读[客户端认证参考文档(v1)](/zh-cn/docs/reference/config-api/client-authentication.v1/)。

0 commit comments

Comments
 (0)