Skip to content

Commit f9684bb

Browse files
committed
[zh-cn] sync kubeadm/* pod-failure-policy.md
Signed-off-by: xin.li <[email protected]>
1 parent bb19f19 commit f9684bb

File tree

4 files changed

+55
-53
lines changed

4 files changed

+55
-53
lines changed

content/zh-cn/docs/tasks/administer-cluster/kubeadm/kubeadm-certs.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -435,18 +435,20 @@ Kubernetes 证书颁发机构不是开箱即用。你可以配置外部签名者
435435

436436
<!--
437437
If you're creating a new cluster, you can use a kubeadm
438-
[configuration file](/docs/reference/config-api/kubeadm-config.v1beta3/):
438+
[configuration file](/docs/reference/config-api/kubeadm-config.v1beta4/):
439439
-->
440440
如果你正在创建一个新的集群,你可以使用 kubeadm
441-
的[配置文件](/zh-cn/docs/reference/config-api/kubeadm-config.v1beta3/)。
441+
的[配置文件](/zh-cn/docs/reference/config-api/kubeadm-config.v1beta4/)。
442442

443443
```yaml
444-
apiVersion: kubeadm.k8s.io/v1beta3
444+
apiVersion: kubeadm.k8s.io/v1beta4
445445
kind: ClusterConfiguration
446446
controllerManager:
447447
extraArgs:
448-
cluster-signing-cert-file: /etc/kubernetes/pki/ca.crt
449-
cluster-signing-key-file: /etc/kubernetes/pki/ca.key
448+
- name: "cluster-signing-cert-file"
449+
value: "/etc/kubernetes/pki/ca.crt"
450+
- name: "cluster-signing-key-file"
451+
value: "/etc/kubernetes/pki/ca.key"
450452
```
451453

452454
<!--
@@ -527,7 +529,7 @@ certificates you must pass the following minimal configuration to `kubeadm init`
527529
你必须向 `kubeadm init` 传递如下最小配置数据:
528530

529531
```yaml
530-
apiVersion: kubeadm.k8s.io/v1beta3
532+
apiVersion: kubeadm.k8s.io/v1beta4
531533
kind: ClusterConfiguration
532534
---
533535
apiVersion: kubelet.config.k8s.io/v1beta1
@@ -658,13 +660,13 @@ Sharing the `admin.conf` with additional users is **not recommended**!
658660
Instead, you can use the [`kubeadm kubeconfig user`](/docs/reference/setup-tools/kubeadm/kubeadm-kubeconfig)
659661
command to generate kubeconfig files for additional users.
660662
The command accepts a mixture of command line flags and
661-
[kubeadm configuration](/docs/reference/config-api/kubeadm-config.v1beta3/) options.
663+
[kubeadm configuration](/docs/reference/config-api/kubeadm-config.v1beta4/) options.
662664
The generated kubeconfig will be written to stdout and can be piped to a file using
663665
`kubeadm kubeconfig user ... > somefile.conf`.
664666
-->
665667
你要使用 [`kubeadm kubeconfig user`](/zh-cn/docs/reference/setup-tools/kubeadm/kubeadm-kubeconfig)
666668
命令为其他用户生成 kubeconfig 文件,这个命令支持命令行参数和
667-
[kubeadm 配置结构](/zh-cn/docs/reference/config-api/kubeadm-config.v1beta3/)。
669+
[kubeadm 配置结构](/zh-cn/docs/reference/config-api/kubeadm-config.v1beta4/)。
668670
以上命令会将 kubeconfig 打印到终端上,也可以使用 `kubeadm kubeconfig user ... > somefile.conf`
669671
输出到一个文件中。
670672

@@ -673,9 +675,22 @@ Example configuration file that can be used with `--config`:
673675
-->
674676
如下 kubeadm 可以在 `--config` 后加的配置文件示例:
675677

678+
<!--
679+
```yaml
680+
# example.yaml
681+
apiVersion: kubeadm.k8s.io/v1beta4
682+
kind: ClusterConfiguration
683+
# Will be used as the target "cluster" in the kubeconfig
684+
clusterName: "kubernetes"
685+
# Will be used as the "server" (IP or DNS name) of this cluster in the kubeconfig
686+
controlPlaneEndpoint: "some-dns-address:6443"
687+
# The cluster CA key and certificate will be loaded from this local directory
688+
certificatesDir: "/etc/kubernetes/pki"
689+
```
690+
-->
676691
```yaml
677692
# example.yaml
678-
apiVersion: kubeadm.k8s.io/v1beta3
693+
apiVersion: kubeadm.k8s.io/v1beta4
679694
kind: ClusterConfiguration
680695
# kubernetes 将作为 kubeconfig 中集群名称
681696
clusterName: "kubernetes"

content/zh-cn/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ ConfigMap 的内容时不会执行验证。 你必须小心遵循特定组件配
102102
#### Updating the `ClusterConfiguration`
103103
104104
During cluster creation and upgrade, kubeadm writes its
105-
[`ClusterConfiguration`](/docs/reference/config-api/kubeadm-config.v1beta3/)
105+
[`ClusterConfiguration`](/docs/reference/config-api/kubeadm-config.v1beta4/)
106106
in a ConfigMap called `kubeadm-config` in the `kube-system` namespace.
107107
108108
To change a particular option in the `ClusterConfiguration` you can edit the ConfigMap with this command:

content/zh-cn/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade.md

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,18 @@ The upgrade workflow at high level is the following:
9898
<!--
9999
- To verify that the kubelet service has successfully restarted after the kubelet has been upgraded,
100100
you can execute `systemctl status kubelet` or view the service logs with `journalctl -xeu kubelet`.
101-
- Usage of the `--config` flag of `kubeadm upgrade` with
102-
[kubeadm configuration API types](/docs/reference/config-api/kubeadm-config.v1beta3)
103-
with the purpose of reconfiguring the cluster is not recommended and can have unexpected results. Follow the steps in
101+
- `kubeadm upgrade` supports `--config` with a
102+
[`UpgradeConfiguration` API type](/docs/reference/config-api/kubeadm-config.v1beta4) which can
103+
be used to configure the upgrade process.
104+
- `kubeadm upgrade` does not support reconfiguration of an existing cluster. Follow the steps in
104105
[Reconfiguring a kubeadm cluster](/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure) instead.
105106
-->
106107
- 要验证 kubelet 服务在升级后是否成功重启,可以执行 `systemctl status kubelet`
107108
`journalctl -xeu kubelet` 查看服务日志。
108-
- 不建议使用 `kubeadm upgrade``--config` 参数和
109-
[kubeadm 配置 API 类型](/zh-cn/docs/reference/config-api/kubeadm-config.v1beta3)来重新配置集群,
110-
这样会产生意想不到的结果。
109+
- `kubeadm upgrade` 支持 `--config`
110+
[`UpgradeConfiguration` API 类型](/zh-cn/docs/reference/config-api/kubeadm-config.v1beta4)
111+
可用于配置升级过程。
112+
- `kubeadm upgrade` 不支持重新配置现有集群。
111113
请按照[重新配置 kubeadm 集群](/zh-cn/docs/tasks/administer-cluster/kubeadm/kubeadm-reconfigure)中的步骤来进行。
112114

113115
<!--
@@ -306,17 +308,6 @@ Pick a control plane node that you wish to upgrade first. It must have the `/etc
306308
更多的信息,可参阅[证书管理指南](/zh-cn/docs/tasks/administer-cluster/kubeadm/kubeadm-certs)
307309
{{</ note >}}
308310

309-
{{< note >}}
310-
<!--
311-
If `kubeadm upgrade plan` shows any component configs that require manual upgrade, users must provide
312-
a config file with replacement configs to `kubeadm upgrade apply` via the `--config` command line flag.
313-
Failing to do so will cause `kubeadm upgrade apply` to exit with an error and not perform an upgrade.
314-
-->
315-
如果 `kubeadm upgrade plan` 给出任何需要手动升级的组件配置,
316-
用户必须通过 `--config` 命令行标志向 `kubeadm upgrade apply` 命令提供替代的配置文件。
317-
如果不这样做,`kubeadm upgrade apply` 会出错并退出,不再执行升级操作。
318-
{{</ note >}}
319-
320311
<!--
321312
1. Choose a version to upgrade to, and run the appropriate command. For example:
322313
-->
@@ -353,23 +344,14 @@ Pick a control plane node that you wish to upgrade first. It must have the `/etc
353344
the control plane instances have been upgraded before starting to upgrade the addons. You must perform control plane
354345
instances upgrade sequentially or at least ensure that the last control plane instance upgrade is not started until all
355346
the other control plane instances have been upgraded completely, and the addons upgrade will be performed after the last
356-
control plane instance is upgraded. If you want to keep the old upgrade behavior, please enable the `UpgradeAddonsBeforeControlPlane`
357-
feature gate by `kubeadm upgrade apply --feature-gates=UpgradeAddonsBeforeControlPlane=true`. The Kubernetes project does
358-
not in general recommend enabling this feature gate, you should instead change your upgrade process or cluster addons so
359-
that you do not need to enable the legacy behavior. The `UpgradeAddonsBeforeControlPlane` feature gate will be removed in
360-
a future release.
347+
control plane instance is upgraded.
361348
-->
362349
对于 v1.28 之前的版本,kubeadm 默认采用这样一种模式:在 `kubeadm upgrade apply`
363350
期间立即升级插件(包括 CoreDNS 和 kube-proxy),而不管是否还有其他尚未升级的控制平面实例。
364351
这可能会导致兼容性问题。从 v1.28 开始,kubeadm 默认采用这样一种模式:
365352
在开始升级插件之前,先检查是否已经升级所有的控制平面实例。
366353
你必须按顺序执行控制平面实例的升级,或者至少确保在所有其他控制平面实例已完成升级之前不启动最后一个控制平面实例的升级,
367-
并且在最后一个控制平面实例完成升级之后才执行插件的升级。如果你要保留旧的升级行为,可以通过
368-
`kubeadm upgrade apply --feature-gates=UpgradeAddonsBeforeControlPlane=true` 启用
369-
`UpgradeAddonsBeforeControlPlane` 特性门控。Kubernetes 项目通常不建议启用此特性门控,
370-
你应该转为更改你的升级过程或集群插件,这样你就不需要启用旧的行为。
371-
`UpgradeAddonsBeforeControlPlane` 特性门控将在后续的版本中被移除。
372-
354+
并且在最后一个控制平面实例完成升级之后才执行插件的升级。
373355
{{</ note >}}
374356

375357
<!--

content/zh-cn/docs/tasks/job/pod-failure-policy.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ You should already be familiar with the basic use of [Job](/docs/concepts/worklo
4949

5050
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
5151

52-
<!--
53-
Ensure that the [feature gates](/docs/reference/command-line-tools-reference/feature-gates/)
54-
`PodDisruptionConditions` and `JobPodFailurePolicy` are both enabled in your cluster.
55-
-->
56-
确保[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
57-
`PodDisruptionConditions``JobPodFailurePolicy` 在你的集群中均已启用。
58-
5952
<!--
6053
## Using Pod failure policy to avoid unnecessary Pod retries
6154
@@ -93,18 +86,30 @@ kubectl get jobs -l job-name=job-pod-failure-policy-failjob -o yaml
9386
```
9487

9588
<!--
96-
In the Job status, see a job `Failed` condition with the field `reason`
97-
equal `PodFailurePolicy`. Additionally, the `message` field contains a
98-
more detailed information about the Job termination, such as:
99-
`Container main for pod default/job-pod-failure-policy-failjob-8ckj8 failed with exit code 42 matching FailJob rule at index 0`.
89+
In the Job status, the following conditions display:
90+
- `FailureTarget` condition: has a `reason` field set to `PodFailurePolicy` and
91+
a `message` field with more information about the termination, like
92+
`Container main for pod default/job-pod-failure-policy-failjob-8ckj8 failed with exit code 42 matching FailJob rule at index 0`.
93+
The Job controller adds this condition as soon as the Job is considered a failure.
94+
For details, see [Termination of Job Pods](/docs/concepts/workloads/controllers/job/#termination-of-job-pods).
95+
- `Failed` condition: same `reason` and `message` as the `FailureTarget`
96+
condition. The Job controller adds this condition after all of the Job's Pods
97+
are terminated.
98+
-->
99+
在 Job 状态中,显示以下情况:
100100

101+
- `FailureTarget` 状况:有一个设置为 `PodFailurePolicy``reason`
102+
字段和一个包含更多有关终止信息的 `message` 字段,例如
103+
`Container main for pod default/job-pod-failure-policy-failjob-8ckj8 failed with exit code 42 matching FailJob rule at index 0`
104+
一旦 Job 被视为失败,Job 控制器就会添加此状况。有关详细信息,请参阅
105+
[Job Pod 的终止](/zh-cn/docs/concepts/workloads/controllers/job/#termination-of-job-pods)
106+
- `Failed`:与 `FailureTarget` 状况相同的 `reason``message`
107+
Job 控制器会在 Job 的所有 Pod 终止后添加此状况。
108+
109+
<!--
101110
For comparison, if the Pod failure policy was disabled it would take 6 retries
102111
of the Pod, taking at least 2 minutes.
103112
-->
104-
在 Job 状态中,看到一个任务状况为 `Failed`,其 `reason` 字段等于 `PodFailurePolicy`
105-
此外,`message` 字段包含有关 Job 终止更详细的信息,例如:
106-
`Container main for pod default/job-pod-failure-policy-failjob-8ckj8 failed with exit code 42 matching FailJob rule at index 0`
107-
108113
为了比较,如果 Pod 失效策略被禁用,将会让 Pod 重试 6 次,用时至少 2 分钟。
109114

110115
<!--

0 commit comments

Comments
 (0)