Skip to content

Commit 53efeed

Browse files
committed
[zh-cn] Update authorization page
1 parent 1eca905 commit 53efeed

File tree

1 file changed

+78
-72
lines changed

1 file changed

+78
-72
lines changed

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

Lines changed: 78 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ cloud-provider-wide access control systems which may handle other APIs besides
3535
the Kubernetes API.
3636
-->
3737
在 Kubernetes 中,你必须在鉴权(授予访问权限)之前进行身份验证(登录),有关身份验证的信息,
38-
请参阅[访问控制概述](/zh/docs/concepts/security/controlling-access/).
38+
请参阅[访问控制概述](/zh-cn/docs/concepts/security/controlling-access/).
3939

4040
Kubernetes 期望请求中存在 REST API 常见的属性。
4141
这意味着 Kubernetes 鉴权适用于现有的组织范围或云提供商范围的访问控制系统,
@@ -48,7 +48,15 @@ Kubernetes authorizes API requests using the API server. It evaluates all of the
4848
request attributes against all policies and allows or denies the request. All
4949
parts of an API request must be allowed by some policy in order to proceed. This
5050
means that permissions are denied by default.
51+
-->
52+
## 确定是允许还是拒绝请求 {#determine-whether-a-request-is-allowed-or-denied}
53+
54+
Kubernetes 使用 API 服务器对 API 请求进行鉴权。
55+
它根据所有策略评估所有请求属性来决定允许或拒绝请求。
56+
一个 API 请求的所有部分都必须被某些策略允许才能继续。
57+
这意味着默认情况下拒绝权限。
5158

59+
<!--
5260
(Although Kubernetes uses the API server, access controls and policies that
5361
depend on specific fields of specific kinds of objects are handled by Admission
5462
Controllers.)
@@ -58,13 +66,6 @@ If any authorizer approves or denies a request, that decision is immediately
5866
returned and no other authorizer is consulted. If all modules have no opinion on
5967
the request, then the request is denied. A deny returns an HTTP status code 403.
6068
-->
61-
## 确定是允许还是拒绝请求
62-
63-
Kubernetes 使用 API 服务器对 API 请求进行鉴权。
64-
它根据所有策略评估所有请求属性来决定允许或拒绝请求。
65-
一个 API 请求的所有部分都必须被某些策略允许才能继续。
66-
这意味着默认情况下拒绝权限。
67-
6869
(尽管 Kubernetes 使用 API 服务器,但是依赖于特定对象种类的特定字段的访问控制
6970
和策略由准入控制器处理。)
7071

@@ -94,38 +95,39 @@ Kubernetes reviews only the following API request attributes:
9495

9596
Kubernetes 仅审查以下 API 请求属性:
9697

97-
* **用户** - 身份验证期间提供的 `user` 字符串。
98-
* **** - 经过身份验证的用户所属的组名列表。
99-
* **额外信息** - 由身份验证层提供的任意字符串键到字符串值的映射。
100-
* **API** - 指示请求是否针对 API 资源。
101-
* **请求路径** - 各种非资源端点的路径,如 `/api``/healthz`
102-
* **API 请求动词** - API 动词 `get``list``create``update``patch``watch`
98+
* **用户** —— 身份验证期间提供的 `user` 字符串。
99+
* **** —— 经过身份验证的用户所属的组名列表。
100+
* **额外信息** —— 由身份验证层提供的任意字符串键到字符串值的映射。
101+
* **API** —— 指示请求是否针对 API 资源。
102+
* **请求路径** —— 各种非资源端点的路径,如 `/api``/healthz`
103+
* **API 请求动词** —— API 动词 `get``list``create``update``patch``watch`
103104
`proxy``redirect``delete``deletecollection` 用于资源请求。
104-
要确定资源 API 端点的请求动词,请参阅
105-
[确定请求动词](#determine-the-request-verb)
106-
* **HTTP 请求动词** - HTTP 动词 `get``post``put``delete` 用于非资源请求。
107-
* **Resource** - 正在访问的资源的 ID 或名称(仅限资源请求)-
105+
要确定资源 API 端点的请求动词,请参阅[确定请求动词](#determine-the-request-verb)
106+
* **HTTP 请求动词** —— HTTP 动词 `get``post``put``delete` 用于非资源请求。
107+
* **资源** —— 正在访问的资源的 ID 或名称(仅限资源请求)-
108108
对于使用 `get``update``patch``delete` 动词的资源请求,你必须提供资源名称。
109-
* **子资源** - 正在访问的子资源(仅限资源请求)。
110-
* **名字空间** - 正在访问的对象的名称空间(仅适用于名字空间资源请求)。
111-
* **API 组** - 正在访问的 {{< glossary_tooltip text="API 组" term_id="api-group" >}}
112-
(仅限资源请求)。空字符串表示[核心 API 组](/zh/docs/reference/using-api/#api-groups)
109+
* **子资源** —— 正在访问的子资源(仅限资源请求)。
110+
* **名字空间** —— 正在访问的对象的名称空间(仅适用于名字空间资源请求)。
111+
* **API 组** —— 正在访问的 {{< glossary_tooltip text="API 组" term_id="api-group" >}}
112+
(仅限资源请求)。空字符串表示[核心 API 组](/zh-cn/docs/reference/using-api/#api-groups)
113113

114114
<!--
115115
## Determine the Request Verb
116116
117117
**Non-resource requests**
118118
Requests to endpoints other than `/api/v1/...` or `/apis/<group>/<version>/...`
119119
are considered "non-resource requests", and use the lower-cased HTTP method of the request as the verb.
120+
120121
For example, a `GET` request to endpoints like `/api` or `/healthz` would use `get` as the verb.
121122
-->
122123
## 确定请求动词 {#determine-the-request-verb}
123124

124125
**非资源请求**
125126

126-
对于 `/api/v1/...``/apis/<group>/<version>/...` 之外的端点的请求被
127-
视为“非资源请求(Non-Resource Requests)”,并使用该请求的 HTTP 方法的
128-
小写形式作为其请求动词。
127+
对于 `/api/v1/...``/apis/<group>/<version>/...`
128+
之外的端点的请求被视为 “非资源请求(Non-Resource Requests)”,
129+
并使用该请求的 HTTP 方法的小写形式作为其请求动词。
130+
129131
例如,对 `/api``/healthz` 这类端点的 `GET` 请求将使用 `get` 作为其动词。
130132

131133
<!--
@@ -137,8 +139,7 @@ collection of resources:
137139
-->
138140
**资源请求**
139141

140-
要确定对资源 API 端点的请求动词,需要查看所使用的 HTTP 动词以及该请求是针对
141-
单个资源还是一组资源:
142+
要确定对资源 API 端点的请求动词,需要查看所使用的 HTTP 动词以及该请求是针对单个资源还是一组资源:
142143

143144
<!--
144145
HTTP verb | request verb
@@ -169,19 +170,19 @@ Kubernetes sometimes checks authorization for additional permissions using speci
169170
-->
170171
Kubernetes 有时使用专门的动词以对额外的权限进行鉴权。例如:
171172

172-
* [PodSecurityPolicy](/zh/docs/concepts/security/pod-security-policy/)
173+
* [PodSecurityPolicy](/zh-cn/docs/concepts/security/pod-security-policy/)
173174
* `policy` API 组中 `podsecuritypolicies` 资源使用 `use` 动词
174-
* [RBAC](/zh/docs/reference/access-authn-authz/rbac/#privilege-escalation-prevention-and-bootstrapping)
175+
* [RBAC](/zh-cn/docs/reference/access-authn-authz/rbac/#privilege-escalation-prevention-and-bootstrapping)
175176
*`rbac.authorization.k8s.io` API 组中 `roles``clusterroles` 资源的 `bind`
176177
`escalate` 动词
177-
* [身份认证](/zh/docs/reference/access-authn-authz/authentication/)
178+
* [身份认证](/zh-cn/docs/reference/access-authn-authz/authentication/)
178179
* 对核心 API 组中 `users``groups``serviceaccounts` 以及 `authentication.k8s.io`
179180
API 组中的 `userextras` 所使用的 `impersonate` 动词。
180181

181182
<!--
182183
## Authorization Modules {#authorization-modules}
183184
184-
* **Node** - A special-purpose authorizer that grants permissions to kubelets based on the pods they are scheduled to run. To learn more about using the Node authorization mode, see [Node Authorization](/docs/reference/access-authn-authz/node/).
185+
* **Node** - A special-purpose authorization mode that grants permissions to kubelets based on the pods they are scheduled to run. To learn more about using the Node authorization mode, see [Node Authorization](/docs/reference/access-authn-authz/node/).
185186
* **ABAC** - Attribute-based access control (ABAC) defines an access control paradigm whereby access rights are granted to users through the use of policies which combine attributes together. The policies can use any type of attributes (user attributes, resource attributes, object, environment attributes, etc). To learn more about using the ABAC mode, see [ABAC Mode](/docs/reference/access-authn-authz/abac/).
186187
* **RBAC** - Role-based access control (RBAC) is a method of regulating access to computer or network resources based on the roles of individual users within an enterprise. In this context, access is the ability of an individual user to perform a specific task, such as view, create, or modify a file. To learn more about using the RBAC mode, see [RBAC Mode](/docs/reference/access-authn-authz/rbac/)
187188
* When specified RBAC (Role-Based Access Control) uses the `rbac.authorization.k8s.io` API group to drive authorization decisions, allowing admins to dynamically configure permission policies through the Kubernetes API.
@@ -190,23 +191,25 @@ Kubernetes 有时使用专门的动词以对额外的权限进行鉴权。例如
190191
-->
191192
## 鉴权模块 {#authorization-modules}
192193

193-
* **Node** - 一个专用鉴权组件,根据调度到 kubelet 上运行的 Pod 为 kubelet 授予权限。
194-
了解有关使用节点鉴权模式的更多信息,请参阅[节点鉴权](/zh/docs/reference/access-authn-authz/node/)
195-
* **ABAC** - 基于属性的访问控制(ABAC)定义了一种访问控制范型,通过使用将属性组合
196-
在一起的策略,将访问权限授予用户。策略可以使用任何类型的属性(用户属性、资源属性、
197-
对象,环境属性等)。要了解有关使用 ABAC 模式的更多信息,请参阅
198-
[ABAC 模式](/zh/docs/reference/access-authn-authz/abac/)
199-
* **RBAC** - 基于角色的访问控制(RBAC)是一种基于企业内个人用户的角色来管理对
200-
计算机或网络资源的访问的方法。在此上下文中,权限是单个用户执行特定任务的能力,
194+
* **Node** —— 一个专用鉴权模式,根据调度到 kubelet 上运行的 Pod 为 kubelet 授予权限。
195+
要了解有关使用节点鉴权模式的更多信息,请参阅[节点鉴权](/zh-cn/docs/reference/access-authn-authz/node/)
196+
* **ABAC** —— 基于属性的访问控制(ABAC)定义了一种访问控制范型,通过使用将属性组合在一起的策略,
197+
将访问权限授予用户。策略可以使用任何类型的属性(用户属性、资源属性、对象,环境属性等)。
198+
要了解有关使用 ABAC 模式的更多信息,请参阅
199+
[ABAC 模式](/zh-cn/docs/reference/access-authn-authz/abac/)
200+
* **RBAC** —— 基于角色的访问控制(RBAC)
201+
是一种基于企业内个人用户的角色来管理对计算机或网络资源的访问的方法。
202+
在此上下文中,权限是单个用户执行特定任务的能力,
201203
例如查看、创建或修改文件。要了解有关使用 RBAC 模式的更多信息,请参阅
202-
[RBAC 模式](/zh/docs/reference/access-authn-authz/rbac/)
203-
* 被启用之后,RBAC(基于角色的访问控制)使用 `rbac.authorization.k8s.io` API 组来
204-
驱动鉴权决策,从而允许管理员通过 Kubernetes API 动态配置权限策略。
204+
[RBAC 模式](/zh-cn/docs/reference/access-authn-authz/rbac/)
205+
* 被启用之后,RBAC(基于角色的访问控制)使用 `rbac.authorization.k8s.io` API
206+
组来驱动鉴权决策,从而允许管理员通过 Kubernetes API 动态配置权限策略。
205207
* 要启用 RBAC,请使用 `--authorization-mode = RBAC` 启动 API 服务器。
206-
* **Webhook** - WebHook 是一个 HTTP 回调:发生某些事情时调用的 HTTP POST;
207-
通过 HTTP POST 进行简单的事件通知。实现 WebHook 的 Web 应用程序会在发生某些事情时
208-
将消息发布到 URL。要了解有关使用 Webhook 模式的更多信息,请参阅
209-
[Webhook 模式](/zh/docs/reference/access-authn-authz/webhook/)
208+
* **Webhook** —— WebHook 是一个 HTTP 回调:发生某些事情时调用的 HTTP POST;
209+
通过 HTTP POST 进行简单的事件通知。
210+
实现 WebHook 的 Web 应用程序会在发生某些事情时将消息发布到 URL。
211+
要了解有关使用 Webhook 模式的更多信息,请参阅
212+
[Webhook 模式](/zh-cn/docs/reference/access-authn-authz/webhook/)
210213

211214
<!--
212215
#### Checking API Access
@@ -225,7 +228,9 @@ a given action, and works regardless of the authorization mode used.
225228
kubectl auth can-i create deployments --namespace dev
226229
```
227230

228-
<!-- The output is similar to this: -->
231+
<!--
232+
The output is similar to this:
233+
-->
229234
输出类似于:
230235

231236
```
@@ -236,7 +241,9 @@ yes
236241
kubectl auth can-i create deployments --namespace prod
237242
```
238243

239-
<!-- The output is similar to this: -->
244+
<!--
245+
The output is similar to this:
246+
-->
240247
输出类似于:
241248

242249
```
@@ -247,15 +254,16 @@ no
247254
Administrators can combine this with [user impersonation](/docs/reference/access-authn-authz/authentication/#user-impersonation)
248255
to determine what action other users can perform.
249256
-->
250-
管理员可以将此与
251-
[用户扮演](/zh/docs/reference/access-authn-authz/authentication/#user-impersonation)
257+
管理员可以将此与[用户扮演(User Impersonation)](/zh-cn/docs/reference/access-authn-authz/authentication/#user-impersonation)
252258
结合使用,以确定其他用户可以执行的操作。
253259

254260
```bash
255261
kubectl auth can-i list secrets --namespace dev --as dave
256262
```
257263

258-
<!-- The output is similar to this: -->
264+
<!--
265+
The output is similar to this:
266+
-->
259267
输出类似于:
260268

261269
```
@@ -266,15 +274,17 @@ no
266274
Similarly, to check whether a ServiceAccount named `dev-sa` in Namespace `dev`
267275
can list Pods in the Namespace `target`:
268276
-->
269-
类似地,检查名字空间 `dev` 里的 `dev-sa` 服务账号是否可以列举名字空间 `target` 里的 Pod:
277+
类似地,检查名字空间 `dev` 里的 `dev-sa` 服务账户是否可以列举名字空间 `target` 里的 Pod:
270278

271279
```bash
272280
kubectl auth can-i list pods \
273281
--namespace target \
274282
--as system:serviceaccount:dev:dev-sa
275283
```
276284

277-
<!-- The output is similar to this: -->
285+
<!--
286+
The output is similar to this:
287+
-->
278288
输出类似于:
279289

280290
```
@@ -297,10 +307,9 @@ field of the returned object is the result of the query.
297307
服务器鉴权公开给外部服务。该组中的其他资源包括:
298308

299309
* `SubjectAccessReview` - 对任意用户的访问进行评估,而不仅仅是当前用户。
300-
当鉴权决策被委派给 API 服务器时很有用。例如,kubelet 和扩展 API 服务器使用
301-
它来确定用户对自己的 API 的访问权限。
302-
* `LocalSubjectAccessReview` - 与 `SubjectAccessReview` 类似,但仅限于特定的
303-
名字空间。
310+
当鉴权决策被委派给 API 服务器时很有用。例如,kubelet 和扩展 API
311+
服务器使用它来确定用户对自己的 API 的访问权限。
312+
* `LocalSubjectAccessReview` - 与 `SubjectAccessReview` 类似,但仅限于特定的名字空间。
304313
* `SelfSubjectRulesReview` - 返回用户可在名字空间内执行的操作集的审阅。
305314
用户可以快速汇总自己的访问权限,或者用于 UI 中的隐藏/显示动作。
306315

@@ -349,7 +358,7 @@ your policies include:
349358
350359
The following flags can be used:
351360
-->
352-
## 为你的鉴权模块设置参数
361+
## 为你的鉴权模块设置参数 {#using-flags-for-your-authorization-module}
353362
354363
你必须在策略中包含一个参数标志,以指明你的策略包含哪个鉴权模块:
355364
@@ -363,24 +372,21 @@ The following flags can be used:
363372
* `--authorization-mode=AlwaysDeny` This flag blocks all requests. Use this flag only for testing.
364373
* `--authorization-mode=AlwaysAllow` This flag allows all requests. Use this flag only if you do not require authorization for your API requests.
365374
-->
366-
* `--authorization-mode=ABAC` 基于属性的访问控制(ABAC)模式允许你
367-
使用本地文件配置策略。
375+
* `--authorization-mode=ABAC` 基于属性的访问控制(ABAC)模式允许你使用本地文件配置策略。
368376
* `--authorization-mode=RBAC` 基于角色的访问控制(RBAC)模式允许你使用
369377
Kubernetes API 创建和存储策略。
370378
* `--authorization-mode=Webhook` WebHook 是一种 HTTP 回调模式,允许你使用远程
371379
REST 端点管理鉴权。
372380
* `--authorization-mode=Node` 节点鉴权是一种特殊用途的鉴权模式,专门对
373381
kubelet 发出的 API 请求执行鉴权。
374382
* `--authorization-mode=AlwaysDeny` 该标志阻止所有请求。仅将此标志用于测试。
375-
* `--authorization-mode=AlwaysAllow` 此标志允许所有请求。仅在你不需要 API 请求
376-
的鉴权时才使用此标志。
383+
* `--authorization-mode=AlwaysAllow` 此标志允许所有请求。仅在你不需要 API 请求的鉴权时才使用此标志。
377384

378385
<!--
379386
You can choose more than one authorization module. Modules are checked in order
380387
so an earlier module has higher priority to allow or deny a request.
381388
-->
382-
你可以选择多个鉴权模块。模块按顺序检查,以便较靠前的模块具有更高的优先级来允许
383-
或拒绝请求。
389+
你可以选择多个鉴权模块。模块按顺序检查,以便较靠前的模块具有更高的优先级来允许或拒绝请求。
384390

385391
<!--
386392
## Privilege escalation via workload creation or edits {#privilege-escalation-via-pod-creation}
@@ -391,8 +397,8 @@ such as an operator, could escalate their privileges in that namespace.
391397
## 通过创建或编辑工作负载提升权限 {#privilege-escalation-via-pod-creation}
392398

393399
能够在名字空间中创建或者编辑 Pod 的用户,
394-
无论是直接操作还是通过[控制器](/zh/docs/concepts/architecture/controller/)(例如,一个 Operator)来操作,
395-
都可以提升他们在该名字空间内的权限。
400+
无论是直接操作还是通过[控制器](/zh-cn/docs/concepts/architecture/controller/)
401+
(例如,一个 Operator)来操作,都可以提升他们在该名字空间内的权限。
396402

397403
{{< caution >}}
398404
<!--
@@ -417,7 +423,8 @@ Details of how these can be misused are documented in [escalation paths](/docs/r
417423
- Mounting volumes meant for other workloads in that namespace
418424
- Can be used to obtain information meant for other workloads, and change it.
419425
-->
420-
### 提升途径 {#escalation-paths}
426+
### 特权提升途径 {#escalation-paths}
427+
421428
- 挂载该名字空间内的任意 Secret
422429
- 可以用来访问其他工作负载专用的 Secret
423430
- 可以用来获取权限更高的服务账号的令牌
@@ -447,9 +454,8 @@ This should be considered when deciding on your RBAC controls.
447454
* To learn more about Authentication, see **Authentication** in [Controlling Access to the Kubernetes API](/docs/concepts/security/controlling-access/).
448455
* To learn more about Admission Control, see [Using Admission Controllers](/docs/reference/access-authn-authz/admission-controllers/).
449456
-->
450-
* 要了解有关身份验证的更多信息,请参阅
451-
[控制对 Kubernetes API 的访问](/zh/docs/concepts/security/controlling-access/)
452-
中的 **身份验证** 部分。
453-
* 要了解有关准入控制的更多信息,请参阅
454-
[使用准入控制器](/zh/docs/reference/access-authn-authz/admission-controllers/)。
457+
* 要了解有关身份验证的更多信息,
458+
请参阅[控制对 Kubernetes API 的访问](/zh-cn/docs/concepts/security/controlling-access/)中的
459+
**身份验证** 部分。
460+
* 要了解有关准入控制的更多信息,请参阅[使用准入控制器](/zh-cn/docs/reference/access-authn-authz/admission-controllers/)。
455461

0 commit comments

Comments
 (0)