Skip to content

Commit 8eb8de0

Browse files
authored
Merge pull request #49216 from my-git9/np-10237
[zh-cn]sync authentication rbac
2 parents 3303c82 + 79fa3f7 commit 8eb8de0

File tree

2 files changed

+108
-10
lines changed

2 files changed

+108
-10
lines changed

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

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,12 @@ jwt:
771771
expression: 'claims.sub'
772772
# extra attributes to be added to the UserInfo object. Keys must be domain-prefix path and must be unique.
773773
extra:
774+
# key is a string to use as the extra attribute key.
775+
# key must be a domain-prefix path (e.g. example.org/foo). All characters before the first "/" must be a valid
776+
# subdomain as defined by RFC 1123. All characters trailing the first "/" must
777+
# be valid HTTP Path characters as defined by RFC 3986.
778+
# k8s.io, kubernetes.io and their subdomains are reserved for Kubernetes use and cannot be used.
779+
# key must be lowercase and unique across all extra attributes.
774780
- key: 'example.com/tenant'
775781
# valueExpression is a CEL expression that evaluates to a string or a list of strings.
776782
valueExpression: 'claims.tenant'
@@ -869,6 +875,12 @@ jwt:
869875
expression: 'claims.sub'
870876
# 要添加到 UserInfo 对象的其他属性,键必须是域前缀路径并且必须是唯一的。
871877
extra:
878+
# key 是用作额外属性键的字符串。
879+
# key 必须是域名前缀路径(例如 example.org/foo)。
880+
# 第一个 "/" 之前的所有字符必须是 RFC 1123 定义的有效子域名。
881+
# 第一个 "/" 之后的所有字符必须是 RFC 3986 定义的有效 HTTP 路径字符。
882+
# k8s.io, kubernetes.io 及其子域名保留供 Kubernetes 使用,不能使用。
883+
# key 必须是小写,并且在所有额外属性中唯一。
872884
- key: 'example.com/tenant'
873885
# valueExpression 是一个计算结果为字符串或字符串列表的 CEL 表达式。
874886
valueExpression: 'claims.tenant'
@@ -1901,13 +1913,12 @@ that grant access to the `*` user or `*` group do not include anonymous users.
19011913

19021914
<!--
19031915
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.
1916+
authenticator. If you set the anonymous field in the `AuthenticationConfiguration`
1917+
file then you cannot set the `--anonymous-auth` flag.
19071918
-->
19081919
`AuthenticationConfiguration` 可用于配置匿名身份认证模块。
1909-
要通过配置文件启用匿名身份认证配置,你需要启用 `AnonymousAuthConfigurableEndpoints` 特性门控。
1910-
当此特性门控被启用时,你不能设置 `--anonymous-auth` 标志。
1920+
如果你在 `AuthenticationConfiguration` 文件中设置了 anonymous 字段,
1921+
那么你不能设置 `--anonymous-auth` 标志。
19111922

19121923
<!--
19131924
The main advantage of configuring anonymous authenticator using the authentication
@@ -2132,6 +2143,19 @@ for UIDs, a user should be granted the following role:
21322143
附加字段会被作为 `userextras` 资源的子资源来执行权限评估。
21332144
如果要允许用户为附加字段 “scopes” 和 UID 设置伪装头部,该用户需要被授予以下角色:
21342145

2146+
<!--
2147+
```yaml
2148+
apiVersion: rbac.authorization.k8s.io/v1
2149+
kind: ClusterRole
2150+
metadata:
2151+
name: scopes-and-uid-impersonator
2152+
rules:
2153+
# Can set "Impersonate-Extra-scopes" header and the "Impersonate-Uid" header.
2154+
- apiGroups: ["authentication.k8s.io"]
2155+
resources: ["userextras/scopes", "uids"]
2156+
verbs: ["impersonate"]
2157+
```
2158+
-->
21352159
```yaml
21362160
apiVersion: rbac.authorization.k8s.io/v1
21372161
kind: ClusterRole
@@ -2150,6 +2174,38 @@ of `resourceNames` a resource can take.
21502174
-->
21512175
你也可以通过约束资源可能对应的 `resourceNames` 限制伪装头部的取值:
21522176

2177+
<!--
2178+
```yaml
2179+
apiVersion: rbac.authorization.k8s.io/v1
2180+
kind: ClusterRole
2181+
metadata:
2182+
name: limited-impersonator
2183+
rules:
2184+
# Can impersonate the user "[email protected]"
2185+
- apiGroups: [""]
2186+
resources: ["users"]
2187+
verbs: ["impersonate"]
2188+
resourceNames: ["[email protected]"]
2189+
2190+
# Can impersonate the groups "developers" and "admins"
2191+
- apiGroups: [""]
2192+
resources: ["groups"]
2193+
verbs: ["impersonate"]
2194+
resourceNames: ["developers","admins"]
2195+
2196+
# Can impersonate the extras field "scopes" with the values "view" and "development"
2197+
- apiGroups: ["authentication.k8s.io"]
2198+
resources: ["userextras/scopes"]
2199+
verbs: ["impersonate"]
2200+
resourceNames: ["view", "development"]
2201+
2202+
# Can impersonate the uid "06f6ce97-e2c5-4ab8-7ba5-7654dd08d52b"
2203+
- apiGroups: ["authentication.k8s.io"]
2204+
resources: ["uids"]
2205+
verbs: ["impersonate"]
2206+
resourceNames: ["06f6ce97-e2c5-4ab8-7ba5-7654dd08d52b"]
2207+
```
2208+
-->
21532209
```yaml
21542210
apiVersion: rbac.authorization.k8s.io/v1
21552211
kind: ClusterRole
@@ -2574,6 +2630,17 @@ the binary `/home/jane/bin/example-client-go-exec-plugin` is executed.
25742630
`./bin/example-client-go-exec-plugin`,则要执行的可执行文件为
25752631
`/home/jane/bin/example-client-go-exec-plugin`
25762632

2633+
<!--
2634+
```yaml
2635+
- name: my-user
2636+
user:
2637+
exec:
2638+
# Path relative to the directory of the kubeconfig
2639+
command: "./bin/example-client-go-exec-plugin"
2640+
apiVersion: "client.authentication.k8s.io/v1"
2641+
interactiveMode: Never
2642+
```
2643+
-->
25772644
```yaml
25782645
- name: my-user
25792646
user:

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

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,37 @@ RBAC 鉴权机制使用 `rbac.authorization.k8s.io`
3737

3838
<!--
3939
To enable RBAC, start the {{< glossary_tooltip text="API server" term_id="kube-apiserver" >}}
40-
with the `--authorization-mode` flag set to a comma-separated list that includes `RBAC`;
41-
for example:
40+
with the `--authorization-config` flag set to a file that includes the `RBAC` authorizer; for example:
4241
-->
4342
要启用 RBAC,在启动 {{< glossary_tooltip text="API 服务器" term_id="kube-apiserver" >}}时将
44-
`--authorization-mode` 参数设置为一个逗号分隔的列表并确保其中包含 `RBAC`
43+
`--authorization-config` 标志设置为包含 `RBAC` 授权者的文件;
44+
例如:
45+
46+
```yaml
47+
apiVersion: apiserver.config.k8s.io/v1
48+
kind: AuthorizationConfiguration
49+
authorizers:
50+
...
51+
- type: RBAC
52+
...
53+
```
54+
55+
<!--
56+
Or, start the {{< glossary_tooltip text="API server" term_id="kube-apiserver" >}} with
57+
the `--authorization-mode` flag set to a comma-separated list that includes `RBAC`;
58+
for example:
59+
-->
60+
或者,启动 {{< glossary_tooltip text="API 服务器" term_id="kube-apiserver" >}}时,
61+
`--authorization-mode` 标志设置为包含 `RBAC` 的逗号分隔列表;
62+
例如:
4563

4664
<!--
4765
```shell
48-
kube-apiserver --authorization-mode=Example,RBAC --other-options --more-options
66+
kube-apiserver --authorization-mode=...,RBAC --other-options --more-options
4967
```
5068
-->
5169
```shell
52-
kube-apiserver --authorization-mode=Example,RBAC --<其他选项> --<其他选项>
70+
kube-apiserver --authorization-mode=...,RBAC --<其他选项> --<其他选项>
5371
```
5472

5573
<!--
@@ -573,6 +591,19 @@ This is similar to the built-in `cluster-admin` role.
573591
下面的示例对 `example.com` API 组中所有当前和未来资源执行所有动作。
574592
这类似于内置的 `cluster-admin`。
575593

594+
<!--
595+
```yaml
596+
apiVersion: rbac.authorization.k8s.io/v1
597+
kind: Role
598+
metadata:
599+
namespace: default
600+
name: example.com-superuser # DO NOT USE THIS ROLE, IT IS JUST AN EXAMPLE
601+
rules:
602+
- apiGroups: ["example.com"]
603+
resources: ["*"]
604+
verbs: ["*"]
605+
```
606+
-->
576607
```yaml
577608
apiVersion: rbac.authorization.k8s.io/v1
578609
kind: Role

0 commit comments

Comments
 (0)