Skip to content

Commit c85f241

Browse files
authored
Merge pull request #47522 from windsonsea/admcon
[zh] Sync access-authn-authz/authentication.md
2 parents 9764869 + e0d1aa6 commit c85f241

File tree

1 file changed

+205
-2
lines changed

1 file changed

+205
-2
lines changed

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

Lines changed: 205 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ on the API server. If you want to use command line flags instead of the configur
649649
continue to work as-is. To access the new capabilities like configuring multiple authenticators,
650650
setting multiple audiences for an issuer, switch to using the configuration file.
651651
-->
652-
你必须使用 API 服务器上的 `--authentication-config` 标志指定身份验证配置的路径
652+
你必须使用 API 服务器上的 `--authentication-config` 标志指定身份认证配置的路径
653653
如果你想使用命令行标志而不是配置文件,命令行标志仍然有效。
654654
要使用新功能(例如配置多个认证组件、为发行者设置多个受众),请切换到使用配置文件。
655655

@@ -677,7 +677,7 @@ command line arguments, and use the configuration file instead.
677677
-->
678678
你不能同时指定 `--authentication-config` 和 `--oidc-*` 命令行参数,
679679
否则API服务器会报告错误,然后立即退出。
680-
如果你想切换到使用结构化身份验证配置,则必须删除 `--oidc-*` 命令行参数,并改用配置文件。
680+
如果你想切换到使用结构化身份认证配置,则必须删除 `--oidc-*` 命令行参数,并改用配置文件。
681681
{{< /note >}}
682682

683683
<!--
@@ -1450,7 +1450,26 @@ Kubernetes API 服务器默认发送 `authentication.k8s.io/v1beta1` 令牌以
14501450
要选择接收 `authentication.k8s.io/v1` 令牌认证,API 服务器必须带着参数
14511451
`--authentication-token-webhook-version=v1` 启动。
14521452
{{< /note >}}
1453+
<!--
1454+
```yaml
1455+
{
1456+
"apiVersion": "authentication.k8s.io/v1",
1457+
"kind": "TokenReview",
1458+
"spec": {
1459+
# Opaque bearer token sent to the API server
1460+
"token": "014fbff9a07c...",
14531461
1462+
# Optional list of the audience identifiers for the server the token was presented to.
1463+
# Audience-aware token authenticators (for example, OIDC token authenticators)
1464+
# should verify the token was intended for at least one of the audiences in this list,
1465+
# and return the intersection of this list and the valid audiences for the token in the response status.
1466+
# This ensures the token is valid to authenticate to the server it was presented to.
1467+
# If no audiences are provided, the token should be validated to authenticate to the Kubernetes API server.
1468+
"audiences": ["https://myserver.example.com", "https://myserver.internal.example.com"]
1469+
}
1470+
}
1471+
```
1472+
-->
14541473
```yaml
14551474
{
14561475
"apiVersion": "authentication.k8s.io/v1",
@@ -1471,6 +1490,26 @@ Kubernetes API 服务器默认发送 `authentication.k8s.io/v1beta1` 令牌以
14711490
```
14721491
{{% /tab %}}
14731492
{{% tab name="authentication.k8s.io/v1beta1" %}}
1493+
<!--
1494+
```yaml
1495+
{
1496+
"apiVersion": "authentication.k8s.io/v1beta1",
1497+
"kind": "TokenReview",
1498+
"spec": {
1499+
# Opaque bearer token sent to the API server
1500+
"token": "014fbff9a07c...",
1501+
1502+
# Optional list of the audience identifiers for the server the token was presented to.
1503+
# Audience-aware token authenticators (for example, OIDC token authenticators)
1504+
# should verify the token was intended for at least one of the audiences in this list,
1505+
# and return the intersection of this list and the valid audiences for the token in the response status.
1506+
# This ensures the token is valid to authenticate to the server it was presented to.
1507+
# If no audiences are provided, the token should be validated to authenticate to the Kubernetes API server.
1508+
"audiences": ["https://myserver.example.com", "https://myserver.internal.example.com"]
1509+
}
1510+
}
1511+
```
1512+
-->
14741513
```yaml
14751514
{
14761515
"apiVersion": "authentication.k8s.io/v1beta1",
@@ -1505,6 +1544,38 @@ A successful validation of the bearer token would return:
15051544

15061545
{{< tabs name="TokenReview_response_success" >}}
15071546
{{% tab name="authentication.k8s.io/v1" %}}
1547+
<!--
1548+
```yaml
1549+
{
1550+
"apiVersion": "authentication.k8s.io/v1",
1551+
"kind": "TokenReview",
1552+
"status": {
1553+
"authenticated": true,
1554+
"user": {
1555+
# Required
1556+
"username": "[email protected]",
1557+
# Optional
1558+
"uid": "42",
1559+
# Optional group memberships
1560+
"groups": ["developers", "qa"],
1561+
# Optional additional information provided by the authenticator.
1562+
# This should not contain confidential data, as it can be recorded in logs
1563+
# or API objects, and is made available to admission webhooks.
1564+
"extra": {
1565+
"extrafield1": [
1566+
"extravalue1",
1567+
"extravalue2"
1568+
]
1569+
}
1570+
},
1571+
# Optional list audience-aware token authenticators can return,
1572+
# containing the audiences from the `spec.audiences` list for which the provided token was valid.
1573+
# If this is omitted, the token is considered to be valid to authenticate to the Kubernetes API server.
1574+
"audiences": ["https://myserver.example.com"]
1575+
}
1576+
}
1577+
```
1578+
-->
15081579
```yaml
15091580
{
15101581
"apiVersion": "authentication.k8s.io/v1",
@@ -1537,6 +1608,38 @@ A successful validation of the bearer token would return:
15371608
```
15381609
{{% /tab %}}
15391610
{{% tab name="authentication.k8s.io/v1beta1" %}}
1611+
<!--
1612+
```yaml
1613+
{
1614+
"apiVersion": "authentication.k8s.io/v1beta1",
1615+
"kind": "TokenReview",
1616+
"status": {
1617+
"authenticated": true,
1618+
"user": {
1619+
# Required
1620+
"username": "[email protected]",
1621+
# Optional
1622+
"uid": "42",
1623+
# Optional group memberships
1624+
"groups": ["developers", "qa"],
1625+
# Optional additional information provided by the authenticator.
1626+
# This should not contain confidential data, as it can be recorded in logs
1627+
# or API objects, and is made available to admission webhooks.
1628+
"extra": {
1629+
"extrafield1": [
1630+
"extravalue1",
1631+
"extravalue2"
1632+
]
1633+
}
1634+
},
1635+
# Optional list audience-aware token authenticators can return,
1636+
# containing the audiences from the `spec.audiences` list for which the provided token was valid.
1637+
# If this is omitted, the token is considered to be valid to authenticate to the Kubernetes API server.
1638+
"audiences": ["https://myserver.example.com"]
1639+
}
1640+
}
1641+
```
1642+
-->
15401643
```yaml
15411644
{
15421645
"apiVersion": "authentication.k8s.io/v1beta1",
@@ -1577,6 +1680,21 @@ An unsuccessful request would return:
15771680

15781681
{{< tabs name="TokenReview_response_error" >}}
15791682
{{% tab name="authentication.k8s.io/v1" %}}
1683+
<!--
1684+
```yaml
1685+
{
1686+
"apiVersion": "authentication.k8s.io/v1",
1687+
"kind": "TokenReview",
1688+
"status": {
1689+
"authenticated": false,
1690+
# Optionally include details about why authentication failed.
1691+
# If no error is provided, the API will return a generic Unauthorized message.
1692+
# The error field is ignored when authenticated=true.
1693+
"error": "Credentials are expired"
1694+
}
1695+
}
1696+
```
1697+
-->
15801698
```yaml
15811699
{
15821700
"apiVersion": "authentication.k8s.io/v1",
@@ -1592,6 +1710,21 @@ An unsuccessful request would return:
15921710
```
15931711
{{% /tab %}}
15941712
{{% tab name="authentication.k8s.io/v1beta1" %}}
1713+
<!--
1714+
```yaml
1715+
{
1716+
"apiVersion": "authentication.k8s.io/v1beta1",
1717+
"kind": "TokenReview",
1718+
"status": {
1719+
"authenticated": false,
1720+
# Optionally include details about why authentication failed.
1721+
# If no error is provided, the API will return a generic Unauthorized message.
1722+
# The error field is ignored when authenticated=true.
1723+
"error": "Credentials are expired"
1724+
}
1725+
}
1726+
```
1727+
-->
15951728
```yaml
15961729
{
15971730
"apiVersion": "authentication.k8s.io/v1beta1",
@@ -1759,6 +1892,76 @@ that grant access to the `*` user or `*` group do not include anonymous users.
17591892
`system:unauthenticated` 用户组执行显式的权限判定,所以之前的为用户 `*` 或用户组
17601893
`*` 赋予访问权限的策略规则都不再包含匿名用户。
17611894

1895+
<!--
1896+
### Anonymous Authenticator Configuration
1897+
-->
1898+
### 匿名身份认证模块配置 {#anonymous-authenticator-configuration}
1899+
1900+
{{< feature-state feature_gate_name="AnonymousAuthConfigurableEndpoints" >}}
1901+
1902+
<!--
1903+
The `AuthenticationConfiguration` can be used to configure the anonymous
1904+
authenticator. To enable configuring anonymous auth via the config file you need
1905+
enable the `AnonymousAuthConfigurableEndpoints` feature gate. When this feature
1906+
gate is enabled you cannot set the `--anonymous-auth` flag.
1907+
-->
1908+
`AuthenticationConfiguration` 可用于配置匿名身份认证模块。
1909+
要通过配置文件启用匿名身份认证配置,你需要启用 `AnonymousAuthConfigurableEndpoints` 特性门控。
1910+
当此特性门控被启用时,你不能设置 `--anonymous-auth` 标志。
1911+
1912+
<!--
1913+
The main advantage of configuring anonymous authenticator using the authentication
1914+
configuration file is that in addition to enabling and disabling anonymous authentication
1915+
you can also configure which endpoints support anonymous authentication.
1916+
1917+
A sample authentication configuration file is below:
1918+
-->
1919+
使用身份认证配置文件来配置匿名身份认证模块的主要优点是,
1920+
除了启用和禁用匿名身份认证外,你还可以配置哪些端点支持匿名身份认证。
1921+
1922+
以下是一个身份认证配置文件示例:
1923+
1924+
<!--
1925+
```yaml
1926+
---
1927+
#
1928+
# CAUTION: this is an example configuration.
1929+
# Do not use this for your own cluster!
1930+
#
1931+
apiVersion: apiserver.config.k8s.io/v1beta1
1932+
kind: AuthenticationConfiguration
1933+
anonymous:
1934+
enabled: true
1935+
conditions:
1936+
- path: /livez
1937+
- path: /readyz
1938+
- path: /healthz
1939+
```
1940+
-->
1941+
```yaml
1942+
---
1943+
#
1944+
# 注意:这是一个示例配置。
1945+
# 请勿将其用于你自己的集群!
1946+
#
1947+
apiVersion: apiserver.config.k8s.io/v1beta1
1948+
kind: AuthenticationConfiguration
1949+
anonymous:
1950+
enabled: true
1951+
conditions:
1952+
- path: /livez
1953+
- path: /readyz
1954+
- path: /healthz
1955+
```
1956+
1957+
<!--
1958+
In the configuration above only the `/livez`, `/readyz` and `/healthz` endpoints
1959+
are reachable by anonymous requests. Any other endpoints will not be reachable
1960+
even if it is allowed by RBAC configuration.
1961+
-->
1962+
在上述配置中,只有 `/livez`、`/readyz` 和 `/healthz` 端点可以通过匿名请求进行访问。
1963+
即使 RBAC 配置允许进行匿名请求,也不可以访问任何其他端点。
1964+
17621965
<!--
17631966
## User impersonation
17641967

0 commit comments

Comments
 (0)