Skip to content

Commit 99feec9

Browse files
authored
Merge pull request #41815 from windsonsea/admiss
[zh] sync admission-controllers.md and configure-liveness-readiness-startup-probes.md
2 parents 7a51259 + 1de3ced commit 99feec9

File tree

2 files changed

+65
-40
lines changed

2 files changed

+65
-40
lines changed

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

Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ linkTitle: 准入控制器
44
content_type: concept
55
weight: 30
66
---
7-
87
<!--
98
reviewers:
109
- lavalamp
@@ -342,7 +341,8 @@ This admission controller ignores any `PersistentVolumeClaim` updates; it acts o
342341
See [persistent volume](/docs/concepts/storage/persistent-volumes/) documentation about persistent volume claims and
343342
storage classes and how to mark a storage class as default.
344343
-->
345-
关于持久卷申领和存储类,以及如何将存储类标记为默认,请参见[持久卷](/zh-cn/docs/concepts/storage/persistent-volumes/)页面。
344+
关于持久卷申领和存储类,以及如何将存储类标记为默认,
345+
请参见[持久卷](/zh-cn/docs/concepts/storage/persistent-volumes/)页面。
346346

347347
### DefaultTolerationSeconds {#defaulttolerationseconds}
348348

@@ -505,6 +505,20 @@ This file may be json or yaml and has the following format:
505505
ImagePolicyWebhook 使用配置文件来为后端行为设置选项。该文件可以是 JSON 或 YAML,
506506
并具有以下格式:
507507
508+
<!--
509+
```yaml
510+
imagePolicy:
511+
kubeConfigFile: /path/to/kubeconfig/for/backend
512+
# time in s to cache approval
513+
allowTTL: 50
514+
# time in s to cache denial
515+
denyTTL: 50
516+
# time in ms to wait between retries
517+
retryBackoff: 500
518+
# determines behavior if the webhook backend fails
519+
defaultAllow: true
520+
```
521+
-->
508522
```yaml
509523
imagePolicy:
510524
kubeConfigFile: /path/to/kubeconfig/for/backend
@@ -635,15 +649,14 @@ group (`--runtime-config=imagepolicy.k8s.io/v1alpha1=true`).
635649
-->
636650
注意,Webhook API 对象与其他 Kubernetes API 对象一样受制于相同的版本控制兼容性规则。
637651
实现者应该知道对 alpha 对象兼容性是相对宽松的,并检查请求的 "apiVersion" 字段,
638-
以确保正确的反序列化。
639-
此外,API 服务器必须启用 `imagepolicy.k8s.io/v1alpha1` API 扩展组
652+
以确保正确的反序列化。此外,API 服务器必须启用 `imagepolicy.k8s.io/v1alpha1` API 扩展组
640653
(`--runtime-config=imagepolicy.k8s.io/v1alpha1=true`)。
641654
{{< /note >}}
642655

643656
<!--
644657
An example request body:
645658
-->
646-
请求载荷示例
659+
请求体示例
647660

648661
```json
649662
{
@@ -808,7 +821,7 @@ group/version via the `--runtime-config` flag, both are on by default.
808821
<!--
809822
#### Use caution when authoring and installing mutating webhooks
810823
-->
811-
#### 谨慎编写和安装变更 webhook {#use-caution-when-authoring-and-installing-mutating-webhooks}
824+
#### 谨慎编写和安装变更 Webhook {#use-caution-when-authoring-and-installing-mutating-webhooks}
812825

813826
<!--
814827
* Users may be confused when the objects they try to create are different from
@@ -860,8 +873,7 @@ This admission controller also prevents deletion of three system reserved namesp
860873
`kube-system`, `kube-public`.
861874
-->
862875
该准入控制器禁止在一个正在被终止的 `Namespace` 中创建新对象,并确保针对不存在的
863-
`Namespace` 的请求被拒绝。
864-
该准入控制器还会禁止删除三个系统保留的名字空间,即 `default`、
876+
`Namespace` 的请求被拒绝。该准入控制器还会禁止删除三个系统保留的名字空间,即 `default`、
865877
`kube-system` 和 `kube-public`。
866878

867879
<!--
@@ -1006,8 +1018,7 @@ This admission controller is disabled by default.
10061018
此准入控制器会自动将由云提供商(如 Azure 或 GCP)定义的区(region)或区域(zone)
10071019
标签附加到 PersistentVolume 上。这有助于确保 Pod 和 PersistentVolume 位于相同的区或区域。
10081020
如果准入控制器不支持为 PersistentVolumes 自动添加标签,那你可能需要手动添加标签,
1009-
以防止 Pod 挂载其他区域的卷。
1010-
PersistentVolumeLabel **已被弃用**,
1021+
以防止 Pod 挂载其他区域的卷。PersistentVolumeLabel **已被弃用**,
10111022
为持久卷添加标签的操作已由{{< glossary_tooltip text="云管理控制器" term_id="cloud-controller-manager" >}}接管。
10121023

10131024
此准入控制器默认被禁用。
@@ -1129,7 +1140,7 @@ admitted, determines if it should be admitted based on the requested security co
11291140
for the namespace that the Pod would be in.
11301141
-->
11311142
PodSecurity 准入控制器在新 Pod 被准入之前对其进行检查,
1132-
根据请求的安全上下文和 Pod 所在命名空间允许的
1143+
根据请求的安全上下文和 Pod 所在名字空间允许的
11331144
[Pod 安全性标准](/zh/docs/concepts/security/pod-security-standards/)的限制来确定新 Pod
11341145
是否应该被准入。
11351146

@@ -1253,21 +1264,34 @@ for more information.
12531264

12541265
### SecurityContextDeny {#securitycontextdeny}
12551266

1256-
{{< feature-state for_k8s_version="v1.0" state="alpha" >}}
1267+
{{< feature-state for_k8s_version="v1.27" state="deprecated" >}}
12571268

12581269
{{< caution >}}
12591270
<!--
1260-
This admission controller plugin is **outdated** and **incomplete**, it may be
1261-
unusable or not do what you would expect. It was originally designed to prevent
1262-
the use of some, but not all, security-sensitive fields. Indeed, fields like
1263-
`privileged`, were not filtered at creation and the plugin was not updated with
1264-
the most recent fields, and new APIs like the `ephemeralContainers` field for a
1265-
Pod.
1271+
The Kubernetes project recommends that you **do not use** the
1272+
`SecurityContextDeny` admission controller.
1273+
1274+
The `SecurityContextDeny` admission controller plugin is deprecated and disabled
1275+
by default. It will be removed in a future version. If you choose to enable the
1276+
`SecurityContextDeny` admission controller plugin, you must enable the
1277+
`SecurityContextDeny` feature gate as well.
1278+
-->
1279+
Kubernetes 项目建议你**不要使用** `SecurityContextDeny` 准入控制器。
1280+
1281+
`SecurityContextDeny` 准入控制器插件已被弃用,并且默认处于禁用状态。
1282+
此插件将在后续的版本中被移除。如果你选择启用 `SecurityContextDeny` 准入控制器插件,
1283+
也必须同时启用 `SecurityContextDeny` 特性门控。
1284+
1285+
<!--
1286+
The `SecurityContextDeny` admission plugin is deprecated because it is outdated
1287+
and incomplete; it may be unusable or not do what you would expect. As
1288+
implemented, this plugin is unable to restrict all security-sensitive attributes
1289+
of the Pod API. For example, the `privileged` and `ephemeralContainers` fields
1290+
were never restricted by this plugin.
12661291
-->
1267-
这个准入控制器插件是**过时的**且**不完整的**,它可能无法使用或无法达到你的预期。
1268-
它最初旨在防止使用某些(但不是全部)安全敏感字段。
1269-
事实上,像 `privileged` 这样的字段在创建时并没有被过滤,
1270-
而且该插件没有根据最新的字段和新的 API(例如 Pod 的 `ephemeralContainers` 字段)来更新。
1292+
`SecurityContextDeny` 准入插件已被弃用,因为它已经过时且不完整;
1293+
它可能无法使用或无法达到你的预期。该插件实现之时,就无法限制 Pod API 的所有与安全相关的属性。
1294+
例如,`privileged` 和 `ephemeralContainers` 字段就从未受过此插件的限制。
12711295

12721296
<!--
12731297
The [Pod Security Admission](/docs/concepts/security/pod-security-admission/)
@@ -1333,8 +1357,8 @@ Refer to the
13331357
for more detailed information.
13341358
-->
13351359
`StorageObjectInUseProtection` 插件将 `kubernetes.io/pvc-protection` 或
1336-
`kubernetes.io/pv-protection` finalizers 添加到新创建的持久卷申领(PVC)
1337-
或持久卷(PV)中。如果用户尝试删除 PVC/PV,除非 PVC/PV 的保护控制器移除终结器(finalizers)
1360+
`kubernetes.io/pv-protection` 终结器(finalizers添加到新创建的持久卷申领(PVC)
1361+
或持久卷(PV)中。如果用户尝试删除 PVC/PV,除非 PVC/PV 的保护控制器移除终结器,
13381362
否则 PVC/PV 不会被删除。有关更多详细信息,
13391363
请参考[保护使用中的存储对象](/zh-cn/docs/concepts/storage/persistent-volumes/#storage-object-in-use-protection)。
13401364

@@ -1406,4 +1430,3 @@ You can enable additional admission controllers beyond the default set using the
14061430
(请查看[这里](/zh-cn/docs/reference/command-line-tools-reference/kube-apiserver/#options))。
14071431
因此,你无需显式指定它们。
14081432
你可以使用 `--enable-admission-plugins` 标志( **顺序不重要** )来启用默认设置以外的其他准入控制器。
1409-

content/zh-cn/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ weight: 140
1313
<!--
1414
This page shows how to configure liveness, readiness and startup probes for containers.
1515
16-
The [kubelet](/docs/reference/command-line-tools-reference/kubelet/) uses liveness probes to know when to
17-
restart a container. For example, liveness probes could catch a deadlock,
18-
where an application is running, but unable to make progress. Restarting a
19-
container in such a state can help to make the application more available
20-
despite bugs.
16+
The [kubelet](/docs/reference/command-line-tools-reference/kubelet/) uses
17+
liveness probes to know when to restart a container. For example, liveness
18+
probes could catch a deadlock, where an application is running, but unable to
19+
make progress. Restarting a container in such a state can help to make the
20+
application more available despite bugs.
2121
-->
2222
这篇文章介绍如何给容器配置存活(Liveness)、就绪(Readiness)和启动(Startup)探针。
2323

2424
[kubelet](/zh-cn/docs/reference/command-line-tools-reference/kubelet/)
2525
使用存活探针来确定什么时候要重启容器。
26-
例如,存活探针可以探测到应用死锁(应用程序在运行,但是无法继续执行后面的步骤)情况。
26+
例如,存活探针可以探测到应用死锁(应用在运行,但是无法继续执行后面的步骤)情况。
2727
重启这种状态下的容器有助于提高应用的可用性,即使其中存在缺陷。
2828

2929
<!--
@@ -41,7 +41,7 @@ One use of this signal is to control which Pods are used as backends for Service
4141
When a Pod is not ready, it is removed from Service load balancers.
4242
4343
The kubelet uses startup probes to know when a container application has started.
44-
If such a probe is configured, it disables liveness and readiness checks until
44+
If such a probe is configured, liveness and readiness probes do not start until
4545
it succeeds, making sure those probes don't interfere with the application startup.
4646
This can be used to adopt liveness checks on slow starting containers, avoiding them
4747
getting killed by the kubelet before they are up and running.
@@ -52,8 +52,7 @@ kubelet 使用就绪探针可以知道容器何时准备好接受请求流量,
5252
若 Pod 尚未就绪,会被从 Service 的负载均衡器中剔除。
5353

5454
kubelet 使用启动探针来了解应用容器何时启动。
55-
如果配置了这类探针,你就可以控制容器在启动成功后再进行存活性和就绪态检查,
56-
确保这些存活、就绪探针不会影响应用的启动。
55+
如果配置了这类探针,存活探针和就绪探针成功之前不会重启,确保这些探针不会影响应用的启动。
5756
启动探针可以用于对慢启动容器进行存活性检测,避免它们在启动运行之前就被杀掉。
5857

5958
{{< caution >}}
@@ -74,9 +73,9 @@ scalable; and increased workload on remaining pods due to some failed pods.
7473
Understand the difference between readiness and liveness probes and when to apply them for your app.
7574
-->
7675
错误的存活探针可能会导致级联故障。
77-
这会导致在高负载下容器重启;例如由于应用程序无法扩展,导致客户端请求失败;以及由于某些
76+
这会导致在高负载下容器重启;例如由于应用无法扩展,导致客户端请求失败;以及由于某些
7877
Pod 失败而导致剩余 Pod 的工作负载增加。了解就绪探针和存活探针之间的区别,
79-
以及何时为应用程序配置使用它们非常重要
78+
以及何时为应用配置使用它们非常重要
8079
{{< /note >}}
8180

8281
## {{% heading "prerequisites" %}}
@@ -389,7 +388,7 @@ kubelet 可以配置为使用该协议来执行应用存活性检查。
389388
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
390389
才能配置依赖于 gRPC 的检查机制。
391390

392-
这个例子展示了如何配置 Kubernetes 以将其用于应用程序的存活性检查
391+
这个例子展示了如何配置 Kubernetes 以将其用于应用的存活性检查
393392
类似地,你可以配置就绪探针和启动探针。
394393

395394
下面是一个示例清单:
@@ -557,7 +556,7 @@ provide a fast response to container deadlocks.
557556
If the startup probe never succeeds, the container is killed after 300s and
558557
subject to the pod's `restartPolicy`.
559558
-->
560-
幸亏有启动探测,应用程序将会有最多 5 分钟(30 * 10 = 300s)的时间来完成其启动过程。
559+
幸亏有启动探测,应用将会有最多 5 分钟(30 * 10 = 300s)的时间来完成其启动过程。
561560
一旦启动探测成功一次,存活探测任务就会接管对容器的探测,对容器死锁作出快速响应。
562561
如果启动探测一直没有成功,容器会在 300 秒后被杀死,并且根据 `restartPolicy`
563562
来执行进一步处置。
@@ -646,7 +645,9 @@ liveness and readiness checks:
646645

647646
<!--
648647
* `initialDelaySeconds`: Number of seconds after the container has started before startup,
649-
liveness or readiness probes are initiated. Defaults to 0 seconds. Minimum value is 0.
648+
liveness or readiness probes are initiated. If a startup probe is defined, liveness and
649+
readiness probe delays do not begin until the startup probe has succeeded.
650+
Defaults to 0 seconds. Minimum value is 0.
650651
* `periodSeconds`: How often (in seconds) to perform the probe. Default to 10 seconds.
651652
The minimum value is 1.
652653
* `timeoutSeconds`: Number of seconds after which the probe times out.
@@ -655,7 +656,8 @@ liveness and readiness checks:
655656
after having failed. Defaults to 1. Must be 1 for liveness and startup Probes.
656657
Minimum value is 1.
657658
-->
658-
* `initialDelaySeconds`:容器启动后要等待多少秒后才启动启动、存活和就绪探针,
659+
* `initialDelaySeconds`:容器启动后要等待多少秒后才启动启动、存活和就绪探针。
660+
如果定义了启动探针,则存活探针和就绪探针的延迟将在启动探针已成功之后才开始计算。
659661
默认是 0 秒,最小值是 0。
660662
* `periodSeconds`:执行探测的时间间隔(单位是秒)。默认是 10 秒。最小值是 1。
661663
* `timeoutSeconds`:探测的超时后等待多少秒。默认值是 1 秒。最小值是 1。

0 commit comments

Comments
 (0)