Skip to content

Commit 6f04c6a

Browse files
committed
[zh-cn] sync ingress.md controlling-access.md
Signed-off-by: xin.li <[email protected]>
1 parent 90c0749 commit 6f04c6a

File tree

2 files changed

+72
-42
lines changed

2 files changed

+72
-42
lines changed

content/zh-cn/docs/concepts/security/controlling-access.md

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ content_type: concept
44
weight: 50
55
---
66
<!--
7-
---
87
reviewers:
98
- erictune
109
- lavalamp
1110
title: Controlling Access to the Kubernetes API
1211
content_type: concept
1312
weight: 50
14-
---
1513
-->
1614

1715
<!-- overview -->
@@ -40,11 +38,15 @@ following diagram:
4038
## 传输安全 {#transport-security}
4139

4240
<!--
43-
By default, the Kubernetes API server listens on port 6443 on the first non-localhost network interface, protected by TLS. In a typical production Kubernetes cluster, the API serves on port 443. The port can be changed with the `--secure-port`, and the listening IP address with the `--bind-address` flag.
41+
By default, the Kubernetes API server listens on port 6443 on the first non-localhost
42+
network interface, protected by TLS. In a typical production Kubernetes cluster, the
43+
API serves on port 443. The port can be changed with the `--secure-port`, and the
44+
listening IP address with the `--bind-address` flag.
4445
4546
The API server presents a certificate. This certificate may be signed using
4647
a private certificate authority (CA), or based on a public key infrastructure linked
47-
to a generally recognized CA. The certificate and corresponding private key can be set by using the `--tls-cert-file` and `--tls-private-key-file` flags.
48+
to a generally recognized CA. The certificate and corresponding private key can be set
49+
by using the `--tls-cert-file` and `--tls-private-key-file` flags.
4850
-->
4951
默认情况下,Kubernetes API 服务器在第一个非 localhost 网络接口的 6443 端口上进行监听,
5052
受 TLS 保护。在一个典型的 Kubernetes 生产集群中,API 使用 443 端口。
@@ -65,17 +67,18 @@ Your client can present a TLS client certificate at this stage.
6567

6668
你的客户端可以在此阶段出示 TLS 客户端证书。
6769

68-
<!-- ## Authentication -->
69-
## 认证 {#authentication}
70-
7170
<!--
71+
## Authentication
72+
7273
Once TLS is established, the HTTP request moves to the Authentication step.
7374
This is shown as step **1** in the diagram.
7475
The cluster creation script or cluster admin configures the API server to run
7576
one or more Authenticator modules.
7677
Authenticators are described in more detail in
7778
[Authentication](/docs/reference/access-authn-authz/authentication/).
7879
-->
80+
## 认证 {#authentication}
81+
7982
如上图步骤 **1** 所示,建立 TLS 后, HTTP 请求将进入认证(Authentication)步骤。
8083
集群创建脚本或者集群管理员配置 API 服务器,使之运行一个或多个身份认证组件。
8184
身份认证组件在[认证](/zh-cn/docs/reference/access-authn-authz/authentication/)节中有更详细的描述。
@@ -111,16 +114,20 @@ users in its API.
111114
反之,该用户被认证为特定的 `username`,并且该用户名可用于后续步骤以在其决策中使用。
112115
部分验证器还提供用户的组成员身份,其他则不提供。
113116

114-
<!-- ## Authorization -->
115-
## 鉴权 {#authorization}
116-
117117
<!--
118-
After the request is authenticated as coming from a specific user, the request must be authorized. This is shown as step **2** in the diagram.
118+
## Authorization
119119
120-
A request must include the username of the requester, the requested action, and the object affected by the action. The request is authorized if an existing policy declares that the user has permissions to complete the requested action.
120+
After the request is authenticated as coming from a specific user, the request must
121+
be authorized. This is shown as step **2** in the diagram.
122+
123+
A request must include the username of the requester, the requested action, and
124+
the object affected by the action. The request is authorized if an existing policy
125+
declares that the user has permissions to complete the requested action.
121126
122127
For example, if Bob has the policy below, then he can read pods only in the namespace `projectCaribou`:
123128
-->
129+
## 鉴权 {#authorization}
130+
124131
如上图的步骤 **2** 所示,将请求验证为来自特定的用户后,请求必须被鉴权。
125132

126133
请求必须包含请求者的用户名、请求的行为以及受该操作影响的对象。
@@ -141,7 +148,8 @@ For example, if Bob has the policy below, then he can read pods only in the name
141148
}
142149
```
143150
<!--
144-
If Bob makes the following request, the request is authorized because he is allowed to read objects in the `projectCaribou` namespace:
151+
If Bob makes the following request, the request is authorized because he is
152+
allowed to read objects in the `projectCaribou` namespace:
145153
-->
146154
如果 Bob 执行以下请求,那么请求会被鉴权,因为允许他读取 `projectCaribou` 名称空间中的对象。
147155

@@ -160,11 +168,14 @@ If Bob makes the following request, the request is authorized because he is allo
160168
}
161169
```
162170
<!--
163-
If Bob makes a request to write (`create` or `update`) to the objects in the `projectCaribou` namespace, his authorization is denied.
164-
If Bob makes a request to read (`get`) objects in a different namespace such as `projectFish`, then his authorization is denied.
165-
166-
Kubernetes authorization requires that you use common REST attributes to interact with existing organization-wide or cloud-provider-wide access control systems.
167-
It is important to use REST formatting because these control systems might interact with other APIs besides the Kubernetes API.
171+
If Bob makes a request to write (`create` or `update`) to the objects in the
172+
`projectCaribou` namespace, his authorization is denied. If Bob makes a request
173+
to read (`get`) objects in a different namespace such as `projectFish`, then his authorization is denied.
174+
175+
Kubernetes authorization requires that you use common REST attributes to interact
176+
with existing organization-wide or cloud-provider-wide access control systems.
177+
It is important to use REST formatting because these control systems might
178+
interact with other APIs besides the Kubernetes API.
168179
-->
169180
如果 Bob 在 `projectCaribou` 名字空间中请求写(`create``update`)对象,其鉴权请求将被拒绝。
170181
如果 Bob 在诸如 `projectFish` 这类其它名字空间中请求读取(`get`)对象,其鉴权也会被拒绝。
@@ -179,8 +190,8 @@ If more than one authorization modules are configured, Kubernetes checks each mo
179190
and if any module authorizes the request, then the request can proceed.
180191
If all of the modules deny the request, then the request is denied (HTTP status code 403).
181192
182-
To learn more about Kubernetes authorization, including details about creating policies using the supported authorization modules,
183-
see [Authorization](/docs/reference/access-authn-authz/authorization/).
193+
To learn more about Kubernetes authorization, including details about creating
194+
policies using the supported authorization modules, see [Authorization](/docs/reference/access-authn-authz/authorization/).
184195
-->
185196
Kubernetes 支持多种鉴权模块,例如 ABAC 模式、RBAC 模式和 Webhook 模式等。
186197
管理员创建集群时,他们配置应在 API 服务器中使用的鉴权模块。
@@ -190,10 +201,9 @@ Kubernetes 支持多种鉴权模块,例如 ABAC 模式、RBAC 模式和 Webhoo
190201
要了解更多有关 Kubernetes 鉴权的更多信息,包括有关使用支持鉴权模块创建策略的详细信息,
191202
请参阅[鉴权](/zh-cn/docs/reference/access-authn-authz/authorization/)
192203

193-
<!-- ## Admission control -->
194-
## 准入控制 {#admission-control}
195-
196204
<!--
205+
## Admission control
206+
197207
Admission Control modules are software modules that can modify or reject requests.
198208
In addition to the attributes available to Authorization modules, Admission
199209
Control modules can access the contents of the object that is being created or modified.
@@ -202,6 +212,8 @@ Admission controllers act on requests that create, modify, delete, or connect to
202212
Admission controllers do not act on requests that merely read objects.
203213
When multiple admission controllers are configured, they are called in order.
204214
-->
215+
## 准入控制 {#admission-control}
216+
205217
准入控制模块是可以修改或拒绝请求的软件模块。
206218
除鉴权模块可用的属性外,准入控制模块还可以访问正在创建或修改的对象的内容。
207219

@@ -295,5 +307,5 @@ You can learn about:
295307

296308
你可以了解
297309
- Pod 如何使用
298-
[Secrets](/zh-cn/docs/concepts/configuration/secret/#service-accounts-automatically-create-and-attach-secrets-with-api-credentials)
310+
[Secret](/zh-cn/docs/concepts/configuration/secret/#service-accounts-automatically-create-and-attach-secrets-with-api-credentials)
299311
获取 API 凭证。

content/zh-cn/docs/concepts/services-networking/ingress.md

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ weight: 30
88
---
99
<!--
1010
reviewers:
11-
- bprashanth
11+
- bprashanthluster: A set of Nodes that run containerized app
1212
title: Ingress
1313
content_type: concept
1414
description: >-
@@ -36,10 +36,16 @@ For clarity, this guide defines the following terms:
3636

3737
<!--
3838
* Node: A worker machine in Kubernetes, part of a cluster.
39-
* Cluster: A set of Nodes that run containerized applications managed by Kubernetes. For this example, and in most common Kubernetes deployments, nodes in the cluster are not part of the public internet.
40-
* Edge router: A router that enforces the firewall policy for your cluster. This could be a gateway managed by a cloud provider or a physical piece of hardware.
41-
* Cluster network: A set of links, logical or physical, that facilitate communication within a cluster according to the Kubernetes [networking model](/docs/concepts/cluster-administration/networking/).
42-
* Service: A Kubernetes {{< glossary_tooltip term_id="service" >}} that identifies a set of Pods using {{< glossary_tooltip text="label" term_id="label" >}} selectors. Unless mentioned otherwise, Services are assumed to have virtual IPs only routable within the cluster network.
39+
* Cluster: A set of Nodes that run containerized applications managed by Kubernetes.
40+
For this example, and in most common Kubernetes deployments, nodes in the cluster
41+
are not part of the public internet.
42+
* Edge router: A router that enforces the firewall policy for your cluster. This
43+
could be a gateway managed by a cloud provider or a physical piece of hardware.
44+
* Cluster network: A set of links, logical or physical, that facilitate communication
45+
within a cluster according to the Kubernetes [networking model](/docs/concepts/cluster-administration/networking/).
46+
* Service: A Kubernetes {{< glossary_tooltip term_id="service" >}} that identifies
47+
a set of Pods using {{< glossary_tooltip text="label" term_id="label" >}} selectors.
48+
Unless mentioned otherwise, Services are assumed to have virtual IPs only routable within the cluster network.
4349
-->
4450
* 节点(Node): Kubernetes 集群中的一台工作机器,是集群的一部分。
4551
* 集群(Cluster): 一组运行由 Kubernetes 管理的容器化应用程序的节点。
@@ -54,7 +60,8 @@ For clarity, this guide defines the following terms:
5460
<!--
5561
## What is Ingress?
5662
57-
[Ingress](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#ingress-v1-networking-k8s-io) exposes HTTP and HTTPS routes from outside the cluster to
63+
[Ingress](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#ingress-v1-networking-k8s-io)
64+
exposes HTTP and HTTPS routes from outside the cluster to
5865
{{< link text="services" url="/docs/concepts/services-networking/service/" >}} within the cluster.
5966
Traffic routing is controlled by rules defined on the Ingress resource.
6067
-->
@@ -73,7 +80,11 @@ Here is a simple example where an Ingress sends all its traffic to one Service:
7380
{{< figure src="/zh-cn/docs/images/ingress.svg" alt="ingress-diagram" class="diagram-large" caption="图. Ingress" link="https://mermaid.live/edit#pako:eNqNkktLAzEQgP9KSC8Ku6XWBxKlJz0IHsQeuz1kN7M2uC-SrA9sb6X26MFLFZGKoCC0CIIn_Td1139halZq8eJlE2a--TI7yRn2YgaYYCc6EDRpod39DSdCyAs4RGqhMRndffRfs6dxc9Euox0NgZR2NhpmF73sqos2XVFD-ctt_vY2uTnPh8PJ4BGV7Ro3ZKOoaH5Li6Bt19r56zi7fM4fupP-oC1BHHEPGnWzGlimruno87qXvd__qjdpw2pXErOlxl7Mmn_j1VkcImb-i0q5BT5KAsoj5PMgICXGmCWViA-BlHzfL_b2MWeqRVaSE8uLg1iQUqVS2ZiTHK7LQrFcXfNg9V8WnZu3eEEqFYjCNCslJdd15zXVmcacODP9TMcqJmBN5zL9VKdt_uLM1ZoBzIVNF8WqM06ELRyCCCln-oWcTVkHqxaE4GCitwx8mgbK0Y-no9E0YVTBNuMqFpj4NJBgYZqquH4aeZgokcIPtMWpvtywoDpfU3_yww" >}}
7481

7582
<!--
76-
An Ingress may be configured to give Services externally-reachable URLs, load balance traffic, terminate SSL / TLS, and offer name-based virtual hosting. An [Ingress controller](/docs/concepts/services-networking/ingress-controllers) is responsible for fulfilling the Ingress, usually with a load balancer, though it may also configure your edge router or additional frontends to help handle the traffic.
83+
An Ingress may be configured to give Services externally-reachable URLs,
84+
load balance traffic, terminate SSL / TLS, and offer name-based virtual hosting.
85+
An [Ingress controller](/docs/concepts/services-networking/ingress-controllers)
86+
is responsible for fulfilling the Ingress, usually with a load balancer, though
87+
it may also configure your edge router or additional frontends to help handle the traffic.
7788
-->
7889
Ingress 可为 Service 提供外部可访问的 URL、负载均衡流量、终止 SSL/TLS,以及基于名称的虚拟托管。
7990
[Ingress 控制器](/zh-cn/docs/concepts/services-networking/ingress-controllers)
@@ -93,16 +104,17 @@ Ingress 不会公开任意端口或协议。
93104
<!--
94105
## Prerequisites
95106
96-
You must have an [Ingress controller](/docs/concepts/services-networking/ingress-controllers) to satisfy an Ingress. Only creating an Ingress resource has no effect.
107+
You must have an [Ingress controller](/docs/concepts/services-networking/ingress-controllers)
108+
to satisfy an Ingress. Only creating an Ingress resource has no effect.
97109
-->
98110
## 环境准备
99111

100112
你必须拥有一个 [Ingress 控制器](/zh-cn/docs/concepts/services-networking/ingress-controllers) 才能满足 Ingress 的要求。
101113
仅创建 Ingress 资源本身没有任何效果。
102114

103115
<!--
104-
You may need to deploy an Ingress controller such as [ingress-nginx](https://kubernetes.github.io/ingress-nginx/deploy/). You can choose from a number of
105-
[Ingress controllers](/docs/concepts/services-networking/ingress-controllers).
116+
You may need to deploy an Ingress controller such as [ingress-nginx](https://kubernetes.github.io/ingress-nginx/deploy/).
117+
You can choose from a number of [Ingress controllers](/docs/concepts/services-networking/ingress-controllers).
106118
-->
107119
你可能需要部署 Ingress 控制器,例如 [ingress-nginx](https://kubernetes.github.io/ingress-nginx/deploy/)
108120
你可以从许多 [Ingress 控制器](/zh-cn/docs/concepts/services-networking/ingress-controllers) 中进行选择。
@@ -137,10 +149,10 @@ An Ingress needs `apiVersion`, `kind`, `metadata` and `spec` fields.
137149
The name of an Ingress object must be a valid
138150
[DNS subdomain name](/docs/concepts/overview/working-with-objects/names#dns-subdomain-names).
139151
For general information about working with config files, see [deploying applications](/docs/tasks/run-application/run-stateless-application-deployment/), [configuring containers](/docs/tasks/configure-pod-container/configure-pod-configmap/), [managing resources](/docs/concepts/cluster-administration/manage-deployment/).
140-
Ingress frequently uses annotations to configure some options depending on the Ingress controller, an example of which
141-
is the [rewrite-target annotation](https://github.com/kubernetes/ingress-nginx/blob/main/docs/examples/rewrite/README.md).
142-
Different [Ingress controllers](/docs/concepts/services-networking/ingress-controllers) support different annotations. Review the documentation for
143-
your choice of Ingress controller to learn which annotations are supported.
152+
Ingress frequently uses annotations to configure some options depending on the Ingress controller, an example of which
153+
is the [rewrite-target annotation](https://github.com/kubernetes/ingress-nginx/blob/main/docs/examples/rewrite/README.md).
154+
Different [Ingress controllers](/docs/concepts/services-networking/ingress-controllers) support different annotations.
155+
Review the documentation for your choice of Ingress controller to learn which annotations are supported.
144156
-->
145157
Ingress 需要指定 `apiVersion``kind``metadata``spec` 字段。
146158
Ingress 对象的命名必须是合法的 [DNS 子域名名称](/zh-cn/docs/concepts/overview/working-with-objects/names#dns-subdomain-names)
@@ -200,7 +212,8 @@ Each HTTP rule contains the following information:
200212
incoming request before the load balancer directs traffic to the referenced
201213
Service.
202214
* A backend is a combination of Service and port names as described in the
203-
[Service doc](/docs/concepts/services-networking/service/) or a [custom resource backend](#resource-backend) by way of a {{< glossary_tooltip term_id="CustomResourceDefinition" text="CRD" >}}. HTTP (and HTTPS) requests to the
215+
[Service doc](/docs/concepts/services-networking/service/) or a [custom resource backend](#resource-backend)
216+
by way of a {{< glossary_tooltip term_id="CustomResourceDefinition" text="CRD" >}}. HTTP (and HTTPS) requests to the
204217
Ingress that match the host and path of the rule are sent to the listed backend.
205218
-->
206219
* 可选的 `host`。在此示例中,未指定 `host`,因此该规则适用于通过指定 IP 地址的所有入站 HTTP 通信。
@@ -379,6 +392,7 @@ Ingress 中的每个路径都需要有对应的路径类型(Path Type)。未
379392

380393
<!--
381394
#### Multiple matches
395+
382396
In some cases, multiple paths within an Ingress will match a request. In those
383397
cases precedence will be given first to the longest matching path. If two paths
384398
are still equally matched, precedence will be given to paths with an exact path
@@ -482,6 +496,7 @@ API(可能是一个定制资源(Custom Resource)),而它的
482496
`name` 则为此 API 确定了一个具体的集群作用域的资源。
483497

484498
示例:
499+
485500
```yaml
486501
---
487502
apiVersion: networking.k8s.io/v1
@@ -499,6 +514,7 @@ spec:
499514
kind: ClusterIngressParameter
500515
name: external-config-1
501516
```
517+
502518
{{% /tab %}}
503519
{{% tab name="命名空间作用域" %}}
504520
{{< feature-state for_k8s_version="v1.23" state="stable" >}}
@@ -702,9 +718,9 @@ Ingress 允许你将负载均衡器的数量降至最低。例如,这样的设
702718
{{< figure src="/zh-cn/docs/images/ingressFanOut.svg" alt="ingress-fanout-diagram" class="diagram-large" caption="图. Ingress 扇出" link="https://mermaid.live/edit#pako:eNqNUk1v0zAY_iuWewEpyRKnjM5FPY0DEgfEjk0PTvxmtZbGke3woW03NDjuChNCRRyQkMYFidP4NyXlX5DMjroykLg4j_x8vM6j9xhnkgOm-FCxao4ePx0nJUJZIaA0d6ary48_33xvvnyd3fUD9Kg8VKC131wum_Oz5t0r9CBVE7T-9mF9dbV6_3q9XK7efkaBPxFWOXUOD0X3R8FeFEQkDqKYzK6HOJHvT052cilPNKhnIoNoemAB6i_okIThbU_KVO8hf3oIHYUj59F1an_u18VZ8-PTjRhLuyltZiV5NH0i-ewvBLlFEEvE_yKGGwJKbmtlWu9DjqqCiRLloijogHPuaaPkEdBBnucO-88FN3M6rF54mSykooMwDMdbIUcj7SJispvBvf9KabntlKyotQHlkjZWOkjTdDuGbGLsxE1S36jXl9YD4nWldsc1irtj2D39htdumy1l69q-zH3H2MMLUAsmeLuux50uwWYOC0gwbSGHnNWFSXBSnrbSuuLMwEMujFSY5qzQ4GFWG3nwsswwNaqGXrQvWLsgC6c6_Q0zxBrK" >}}
703719
704720
<!--
705-
would require an Ingress such as:
721+
It would require an Ingress such as:
706722
-->
707-
将需要一个如下所示的 Ingress:
723+
这将需要一个如下所示的 Ingress:
708724
709725
{{< codenew file="service/networking/simple-fanout-example.yaml" >}}
710726
@@ -786,7 +802,9 @@ Ingress 控制器 IP 地址的任何网络流量,而无需基于名称的虚
786802

787803
<!--
788804
For example, the following Ingress routes traffic
789-
requested for `first.bar.com` to `service1`, `second.bar.com` to `service2`, and any traffic whose request host header doesn't match `first.bar.com` and `second.bar.com` to `service3`.
805+
requested for `first.bar.com` to `service1`, `second.bar.com` to `service2`,
806+
and any traffic whose request host header doesn't match `first.bar.com`
807+
and `second.bar.com` to `service3`.
790808
-->
791809
例如,以下 Ingress 会将请求 `first.bar.com` 的流量路由到 `service1`,将请求
792810
`second.bar.com` 的流量路由到 `service2`,而所有其他流量都会被路由到 `service3`

0 commit comments

Comments
 (0)