Skip to content

Commit c49c5f4

Browse files
authored
Merge pull request #48047 from my-git9/pp-30629
[zh-cn] sync api-concepts admission-controllers node
2 parents 7961595 + aa811d4 commit c49c5f4

File tree

4 files changed

+100
-22
lines changed

4 files changed

+100
-22
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,7 @@ If a webhook called by this has side effects (for example, decrementing quota) i
14801480
*must* have a reconciliation system, as it is not guaranteed that subsequent
14811481
webhooks or other validating admission controllers will permit the request to finish.
14821482
-->
1483-
如果以此方式调用的 Webhook 有其它副作用(如:减少配额),则它 **必须** 具有协调机制。
1483+
如果以此方式调用的 Webhook 有其它副作用(如:减少配额),则它**必须**具有协调机制。
14841484
这是因为无法保证后续的 Webhook 或其他验证性准入控制器都允许请求完成。
14851485

14861486
<!--
@@ -1505,4 +1505,4 @@ You can enable additional admission controllers beyond the default set using the
15051505
有。推荐使用的准入控制器默认情况下都处于启用状态
15061506
(请查看[这里](/zh-cn/docs/reference/command-line-tools-reference/kube-apiserver/#options))。
15071507
因此,你无需显式指定它们。
1508-
你可以使用 `--enable-admission-plugins` 标志( **顺序不重要** )来启用默认设置以外的其他准入控制器。
1508+
你可以使用 `--enable-admission-plugins` 标志(**顺序不重要**)来启用默认设置以外的其他准入控制器。

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ Read operations:
5252
* pods
5353
* 与绑定到 kubelet 节点的 Pod 相关的 Secret、ConfigMap、PersistentVolumeClaim 和持久卷
5454

55+
{{< feature-state feature_gate_name="AuthorizeNodeWithSelectors" >}}
56+
57+
<!--
58+
When the `AuthorizeNodeWithSelectors` feature is enabled
59+
(along with the pre-requisite `AuthorizeWithSelectors` feature),
60+
kubelets are only allowed to read their own Node objects,
61+
and are only allowed to read pods bound to their node.
62+
-->
63+
当启用 `AuthorizeNodeWithSelectors` 特性
64+
(以及作为先决条件的 `AuthorizeWithSelectors` 特性)时,
65+
kubelet 只允许读取它们自己的 Node 对象,
66+
并且只允许读取绑定到其节点的 Pod。
67+
5568
<!--
5669
Write operations:
5770
-->
@@ -65,7 +78,7 @@ Write operations:
6578
* events
6679
-->
6780
* 节点和节点状态(启用 `NodeRestriction` 准入插件以限制 kubelet 只能修改自己的节点)
68-
* Pod 和 Pod 状态 (启用 `NodeRestriction` 准入插件以限制 kubelet 只能修改绑定到自身的 Pod)
81+
* Pod 和 Pod 状态启用 `NodeRestriction` 准入插件以限制 kubelet 只能修改绑定到自身的 Pod
6982
* 事件
7083

7184
<!--
@@ -116,7 +129,7 @@ For specifics about how the kubelet determines the hostname, see the
116129
-->
117130
`<nodeName>` 的值**必须**与 kubelet 注册的节点名称精确匹配。默认情况下,节点名称是由
118131
`hostname` 提供的主机名,或者通过 kubelet `--hostname-override`
119-
[选项](/zh-cn/docs/reference/command-line-tools-reference/kubelet/) 覆盖。
132+
[选项](/zh-cn/docs/reference/command-line-tools-reference/kubelet/)覆盖。
120133
但是,当使用 `--cloud-provider` kubelet 选项时,具体的主机名可能由云提供商确定,
121134
忽略本地的 `hostname``--hostname-override` 选项。有关
122135
kubelet 如何确定主机名的详细信息,请参阅
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: 监视(Watch)
3+
id: watch
4+
date: 2024-07-02
5+
full_link: /zh-cn/docs/reference/using-api/api-concepts/#api-verbs
6+
short_description: >
7+
用于以流的形式跟踪 Kubernetes 中对象变化的动词。
8+
9+
aka:
10+
tags:
11+
- API verb
12+
- fundamental
13+
---
14+
15+
<!--
16+
title: Watch
17+
id: watch
18+
date: 2024-07-02
19+
full_link: /docs/reference/using-api/api-concepts/#api-verbs
20+
short_description: >
21+
A verb that is used to track changes to an object in Kubernetes as a stream.
22+
23+
aka:
24+
tags:
25+
- API verb
26+
- fundamental
27+
-->
28+
29+
<!--
30+
A verb that is used to track changes to an object in Kubernetes as a stream.
31+
It is used for the efficient detection of changes.
32+
-->
33+
用于以流的形式跟踪 Kubernetes 中对象更改的动词。
34+
它用于高效检测更改。
35+
36+
<!--more-->
37+
38+
<!--
39+
A verb that is used to track changes to an object in Kubernetes as a stream. Watches allow
40+
efficient detection of changes; for example, a
41+
{{< glossary_tooltip term_id="controller" text="controller">}} that needs to know whenever a
42+
ConfigMap has changed can use a watch rather than polling.
43+
44+
See [Efficient Detection of Changes in API Concepts](/docs/reference/using-api/api-concepts/#efficient-detection-of-changes) for more information.
45+
-->
46+
用于以流的形式跟踪 Kubernetes 中对象变化的动词。
47+
监视可以有效地检测变化;例如,需要知道 ConfigMap
48+
何时发生变化的{{< glossary_tooltip term_id="controller" text="控制器">}}可以使用监视而不是轮询。
49+
请参阅[有效检测 API 概念的变化](/zh-cn/docs/reference/using-api/api-concepts/#efficient-detection-of-changes)了解更多信息。

content/zh-cn/docs/reference/using-api/api-concepts.md

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,18 @@ Kubernetes API 是通过 HTTP 提供的基于资源 (RESTful) 的编程接口。
3232
为了方便或者提高效率,可以以不同的表示形式接受和服务这些资源。
3333

3434
<!--
35-
Kubernetes supports efficient change notifications on resources via *watches*.
35+
Kubernetes supports efficient change notifications on resources via
36+
_watches_:
37+
{{< glossary_definition prepend="in the Kubernetes API, watch is" term_id="watch" length="short" >}}
3638
Kubernetes also provides consistent list operations so that API clients can
3739
effectively cache, track, and synchronize the state of resources.
3840
3941
You can view the [API reference](/docs/reference/kubernetes-api/) online,
4042
or read on to learn about the API in general.
4143
-->
42-
Kubernetes 支持通过 **watch** 实现高效的资源变更通知。
43-
Kubernetes 还提供了一致的列表操作,以便 API 客户端可以有效地缓存、跟踪和同步资源的状态。
44+
Kubernetes 支持通过 **watch** 实现高效的资源变更通知:
45+
{{< glossary_definition prepend="在 Kubernetes API 中,watch 的是" term_id="watch" length="short" >}}
46+
Kubernetes 还提供一致的列表操作,以便 API 客户端可以有效地缓存、跟踪和同步资源的状态。
4447

4548
你可以在线查看 [API 参考](/zh-cn/docs/reference/kubernetes-api/)
4649
或继续阅读以了解 API 的一般信息。
@@ -83,9 +86,9 @@ as a permission check
8386
大多数 Kubernetes API
8487
资源类型都是[对象](/zh-cn/docs/concepts/overview/working-with-objects/kubernetes-objects/#kubernetes-objects)
8588
它们代表集群上某个概念的具体实例,例如 Pod 或名字空间。
86-
少数 API 资源类型是 “虚拟的”,它们通常代表的是操作而非对象本身,
89+
少数 API 资源类型是“虚拟的”,它们通常代表的是操作而非对象本身,
8790
例如权限检查(使用带有 JSON 编码的 `SubjectAccessReview` 主体的 POST 到 `subjectaccessreviews` 资源),
88-
或 Pod 的子资源 `eviction`(用于触发 [API-发起的驱逐](/zh-cn/docs/concepts/scheduling-eviction/api-eviction/))。
91+
或 Pod 的子资源 `eviction`(用于触发 [API 发起的驱逐](/zh-cn/docs/concepts/scheduling-eviction/api-eviction/))。
8992

9093
<!--
9194
### Object names
@@ -161,7 +164,8 @@ Examples:
161164

162165
注意: 核心资源使用 `/api` 而不是 `/apis`,并且不包含 GROUP 路径段。
163166

164-
例如:
167+
例如:
168+
165169
* `/api/v1/namespaces`
166170
* `/api/v1/pods`
167171
* `/api/v1/namespaces/my-namespace/pods`
@@ -187,9 +191,12 @@ The following paths are used to retrieve collections and resources:
187191
你还可以访问资源集合(例如:列出所有 Node)。以下路径用于检索集合和资源:
188192

189193
* 集群作用域的资源:
194+
190195
* `GET /apis/GROUP/VERSION/RESOURCETYPE` - 返回指定资源类型的资源的集合
191196
* `GET /apis/GROUP/VERSION/RESOURCETYPE/NAME` - 返回指定资源类型下名称为 NAME 的资源
197+
192198
* 名字空间作用域的资源:
199+
193200
* `GET /apis/GROUP/VERSION/RESOURCETYPE` - 返回所有名字空间中指定资源类型的全部实例的集合
194201
* `GET /apis/GROUP/VERSION/namespaces/NAMESPACE/RESOURCETYPE` - 返回名字空间 NAMESPACE 内给定资源类型的全部实例的集合
195202
* `GET /apis/GROUP/VERSION/namespaces/NAMESPACE/RESOURCETYPE/NAME` - 返回名字空间 NAMESPACE 中给定资源类型的名称为 NAME 的实例
@@ -535,7 +542,7 @@ response (10-20MB) and consume a large amount of server resources.
535542
-->
536543
在较大规模集群中,检索某些资源类型的集合可能会导致非常大的响应,从而影响服务器和客户端。
537544
例如,一个集群可能有数万个 Pod,每个 Pod 大约相当于 2 KiB 的编码 JSON。
538-
跨所有名字空间检索所有 Pod 可能会导致非常大的响应 (10-20MB) 并消耗大量服务器资源。
545+
跨所有名字空间检索所有 Pod 可能会导致非常大的响应10-20MB并消耗大量服务器资源。
539546

540547
<!--
541548
The Kubernetes API server supports the ability to break a single large collection request
@@ -1280,7 +1287,7 @@ information about warnings and the Kubernetes API, see the blog article
12801287
`Warn`
12811288
:(默认值)使 API 服务器成功处理请求,并向客户端发送告警信息。告警信息通过 `Warning:` 响应头发送,
12821289
并为每个未知字段或重复字段添加一条告警信息。有关告警和相关的 Kubernetes API 的信息,
1283-
可参阅博文[告警:增加实用告警功能](/blog/2020/09/03/warnings/)
1290+
可参阅博文[告警:增加实用告警功能](/zh-cn/blog/2020/09/03/warnings/)
12841291

12851292
<!--
12861293
: The API server rejects the request with a 400 Bad Request error when it
@@ -1418,7 +1425,7 @@ that they do not have side effects, by setting their `sideEffects` field to `Non
14181425
-->
14191426
如果请求的非试运行版本会触发具有副作用的准入控制器,则该请求将失败,而不是冒不希望的副作用的风险。
14201427
所有内置准入控制插件都支持试运行。
1421-
此外,准入 Webhook 还可以设置[配置对象](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#validatingwebhook-v1-admissionregistration-k8s-io)
1428+
此外,准入 Webhook 还可以设置[配置对象](/zh-cn/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#validatingwebhook-v1-admissionregistration-k8s-io)
14221429
`sideEffects` 字段为 `None`,借此声明它们没有副作用。
14231430

14241431
<!--
@@ -1844,7 +1851,7 @@ For **get** and **list**, the semantics of `resourceVersion` are:
18441851

18451852
对于 **get** 和 **list** 而言,`resourceVersion` 的语义为:
18461853

1847-
**get:**
1854+
**get**
18481855

18491856
<!--
18501857
| resourceVersion unset | resourceVersion="0" | resourceVersion="{value other than 0}" |
@@ -1855,7 +1862,7 @@ For **get** and **list**, the semantics of `resourceVersion` are:
18551862
|-----------------------|---------------------|----------------------------------------|
18561863
| 最新版本 | 任何版本 | 不老于给定版本 |
18571864

1858-
**list:**
1865+
**list**
18591866

18601867
<!--
18611868
From version v1.19, Kubernetes API servers support the `resourceVersionMatch` parameter
@@ -1943,21 +1950,31 @@ Any
19431950
for the request to return data at a much older resource version that the client has previously
19441951
observed, particularly in high availability configurations, due to partitions or stale
19451952
caches. Clients that cannot tolerate this should not use this semantic.
1946-
1947-
Most recent
1948-
: Return data at the most recent resource version. The returned data must be
1949-
consistent (in detail: served from etcd via a quorum read).
19501953
-->
19511954
任意版本
19521955
: 返回任何资源版本的数据。最新可用资源版本优先,但不需要强一致性;
19531956
可以提供任何资源版本的数据。由于分区或过时的缓存,
19541957
请求可能返回客户端先前观察到的更旧资源版本的数据,特别是在高可用性配置中。
19551958
不能容忍这种情况的客户不应该使用这种语义。
19561959

1960+
<!--
1961+
Most recent
1962+
: Return data at the most recent resource version. The returned data must be
1963+
consistent (in detail: served from etcd via a quorum read).
1964+
For etcd v3.4.31+ and v3.5.13+ Kubernetes {{< skew currentVersion >}} serves “most recent” reads from the _watch cache_:
1965+
an internal, in-memory store within the API server that caches and mirrors the state of data
1966+
persisted into etcd. Kubernetes requests progress notification to maintain cache consistency against
1967+
the etcd persistence layer. Kubernetes versions v1.28 through to v1.30 also supported this
1968+
feature, although as Alpha it was not recommended for production nor enabled by default until the v1.31 release.
1969+
-->
19571970
最新版本
19581971
: 返回最新资源版本的数据。
19591972
返回的数据必须一致(详细说明:通过仲裁读取从 etcd 提供)。
1960-
1973+
对于 etcd v3.4.31+ 和 v3.5.13+ Kubernetes {{< skew currentVersion >}} 使用**监视缓存**来为“最新”读取提供服务:
1974+
监视缓存是 API 服务器内部的基于内存的存储,用于缓存和镜像持久化到 etcd 中的数据状态。
1975+
Kubernetes 请求进度通知以维护与 etcd 持久层的缓存一致性。Kubernetes
1976+
版本 v1.28 至 v1.30 也支持此特性,尽管当时其处于 Alpha 状态,不推荐用于生产,
1977+
也不默认启用,直到 v1.31 版本才启用。
19611978

19621979
<!--
19631980
Not older than
@@ -1992,15 +2009,14 @@ Continue Token, Exact
19922009

19932010
精确匹配
19942011
: 以提供的确切资源版本返回数据。如果提供的 `resourceVersion` 不可用,
1995-
则服务器以 HTTP 410 “Gone”响应。对于对支持 `resourceVersionMatch` 参数的服务器的 **list** 请求,
2012+
则服务器以 HTTP 410 “Gone” 响应。对于对支持 `resourceVersionMatch` 参数的服务器的 **list** 请求,
19962013
这可以保证集合的 `.metadata.resourceVersion` 与你在查询字符串中请求的 `resourceVersion` 相同。
19972014
该保证不适用于该集合中任何项目的 `.metadata.resourceVersion`。
19982015

19992016
从 token 开始、精确匹配
20002017
: 返回初始分页 **list** 调用的资源版本的数据。
20012018
返回的 **Continue 令牌**负责跟踪最初提供的资源版本,最初提供的资源版本用于在初始分页 **list** 之后的所有分页 **list** 中。
20022019

2003-
20042020
{{< note >}}
20052021
<!--
20062022
When you **list** resources and receive a collection response, the response includes the

0 commit comments

Comments
 (0)