From 29d6c1135d50b9b01de10686d00ef1ff40f18e9c Mon Sep 17 00:00:00 2001 From: Qiming Teng Date: Mon, 29 Mar 2021 20:43:52 +0800 Subject: [PATCH] [zh] Sync changes to workload controllers --- .../workloads/controllers/cron-jobs.md | 8 ++++++ .../workloads/controllers/daemonset.md | 4 +-- .../workloads/controllers/deployment.md | 27 ++++++++++--------- .../concepts/workloads/controllers/job.md | 2 +- .../workloads/controllers/replicaset.md | 6 ++--- .../controllers/replicationcontroller.md | 25 +++++++++-------- 6 files changed, 42 insertions(+), 30 deletions(-) diff --git a/content/zh/docs/concepts/workloads/controllers/cron-jobs.md b/content/zh/docs/concepts/workloads/controllers/cron-jobs.md index a987270233..21eb03385c 100644 --- a/content/zh/docs/concepts/workloads/controllers/cron-jobs.md +++ b/content/zh/docs/concepts/workloads/controllers/cron-jobs.md @@ -154,6 +154,14 @@ at least once. 如果 `startingDeadlineSeconds` 设置为很大的数值或未设置(默认),并且 `concurrencyPolicy` 设置为 `Allow`,则作业将始终至少运行一次。 +{{< caution >}} + +如果 `startingDeadlineSeconds` 的设置值低于 10 秒钟,CronJob 可能无法被调度。 +这是因为 CronJob 控制器每 10 秒钟执行一次检查。 +{{< /caution >}} + diff --git a/content/zh/docs/concepts/workloads/controllers/daemonset.md b/content/zh/docs/concepts/workloads/controllers/daemonset.md index 60f8f656fe..6ad8c561d9 100644 --- a/content/zh/docs/concepts/workloads/controllers/daemonset.md +++ b/content/zh/docs/concepts/workloads/controllers/daemonset.md @@ -278,8 +278,8 @@ the related features. | ---------------------------------------- | ---------- | ------- | ------------------------------------------------------------ | | `node.kubernetes.io/not-ready` | NoExecute | 1.13+ | 当出现类似网络断开的情况导致节点问题时,DaemonSet Pod 不会被逐出。 | | `node.kubernetes.io/unreachable` | NoExecute | 1.13+ | 当出现类似于网络断开的情况导致节点问题时,DaemonSet Pod 不会被逐出。 | -| `node.kubernetes.io/disk-pressure` | NoSchedule | 1.8+ | | -| `node.kubernetes.io/memory-pressure` | NoSchedule | 1.8+ | | +| `node.kubernetes.io/disk-pressure` | NoSchedule | 1.8+ | DaemonSet Pod 被默认调度器调度时能够容忍磁盘压力属性。 | +| `node.kubernetes.io/memory-pressure` | NoSchedule | 1.8+ | DaemonSet Pod 被默认调度器调度时能够容忍内存压力属性。 | | `node.kubernetes.io/unschedulable` | NoSchedule | 1.12+ | DaemonSet Pod 能够容忍默认调度器所设置的 `unschedulable` 属性. | | `node.kubernetes.io/network-unavailable` | NoSchedule | 1.12+ | DaemonSet 在使用宿主网络时,能够容忍默认调度器所设置的 `network-unavailable` 属性。 | diff --git a/content/zh/docs/concepts/workloads/controllers/deployment.md b/content/zh/docs/concepts/workloads/controllers/deployment.md index 14214e7066..0f6ea1846f 100644 --- a/content/zh/docs/concepts/workloads/controllers/deployment.md +++ b/content/zh/docs/concepts/workloads/controllers/deployment.md @@ -102,24 +102,25 @@ In this example: * `selector` 字段定义 Deployment 如何查找要管理的 Pods。 - 在这里,你只需选择在 Pod 模板中定义的标签(`app: nginx`)。 + 在这里,你选择在 Pod 模板中定义的标签(`app: nginx`)。 不过,更复杂的选择规则是也可能的,只要 Pod 模板本身满足所给规则即可。 + {{< note >}} - {{< note >}} - `matchLabels` 字段是 `{key,value}` 偶对的映射。在 `matchLabels` 映射中的单个 `{key,value}` - 映射等效于 `matchExpressions` 中的一个元素,即其 `key` 字段是 “key”,operator 为 “In”,`value` - 数组仅包含 “value”。在 `matchLabels` 和 `matchExpressions` 中给出的所有条件都必须满足才能匹配。 + `spec.selector.matchLabels` 字段是 `{key,value}` 键值对映射。 + 在 `matchLabels` 映射中的每个 `{key,value}` 映射等效于 `matchExpressions` 中的一个元素, + 即其 `key` 字段是 “key”,`operator` 为 “In”,`values` 数组仅包含 “value”。 + 在 `matchLabels` 和 `matchExpressions` 中给出的所有条件都必须满足才能匹配。 {{< /note >}} 或者使用下面的命令: @@ -355,7 +356,7 @@ is changed, for example if the labels or container images of the template are up kubectl set image deployment/nginx-deployment nginx=nginx:1.16.1 --record ``` - + 输出类似于: ``` @@ -429,7 +430,7 @@ up to 3 replicas, as well as scaling down the old ReplicaSet to 0 replicas. kubectl get rs ``` - + 输出类似于: ``` @@ -1179,7 +1180,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess 这样做使得你能够在暂停和恢复执行之间应用多个修补程序,而不会触发不必要的上线操作。 * 例如,对于一个刚刚创建的 Deployment: diff --git a/content/zh/docs/concepts/workloads/controllers/job.md b/content/zh/docs/concepts/workloads/controllers/job.md index 6180d3bd28..a2a6982e54 100644 --- a/content/zh/docs/concepts/workloads/controllers/job.md +++ b/content/zh/docs/concepts/workloads/controllers/job.md @@ -139,7 +139,7 @@ pi-5rwd7 diff --git a/content/zh/docs/concepts/workloads/controllers/replicaset.md b/content/zh/docs/concepts/workloads/controllers/replicaset.md index 46877b02f6..7ad68c9e53 100644 --- a/content/zh/docs/concepts/workloads/controllers/replicaset.md +++ b/content/zh/docs/concepts/workloads/controllers/replicaset.md @@ -345,7 +345,7 @@ pod2 1/1 Running 0 36s ## Writing a ReplicaSet Spec As with all other Kubernetes API objects, a ReplicaSet needs the `apiVersion`, `kind`, and `metadata` fields. -For ReplicaSets, the kind is always just ReplicaSet. +For ReplicaSets, the `kind` is always a ReplicaSet. In Kubernetes 1.9 the API version `apps/v1` on the ReplicaSet kind is the current version and is enabled by default. The API version `apps/v1beta2` is deprecated. Refer to the first lines of the `frontend.yaml` example for guidance. @@ -357,7 +357,7 @@ A ReplicaSet also needs a [`.spec` section](https://git.k8s.io/community/contrib ## 编写 ReplicaSet 的 spec 与所有其他 Kubernetes API 对象一样,ReplicaSet 也需要 `apiVersion`、`kind`、和 `metadata` 字段。 -对于 ReplicaSets 而言,其 kind 始终是 ReplicaSet。 +对于 ReplicaSets 而言,其 `kind` 始终是 ReplicaSet。 在 Kubernetes 1.9 中,ReplicaSet 上的 API 版本 `apps/v1` 是其当前版本,且被 默认启用。API 版本 `apps/v1beta2` 已被废弃。 参考 `frontend.yaml` 示例的第一行。 @@ -375,7 +375,7 @@ The `.spec.template` is a [pod template](/docs/concepts/workloads/pods/#pod-temp required to have labels in place. In our `frontend.yaml` example we had one label: `tier: frontend`. Be careful not to overlap with the selectors of other controllers, lest they try to adopt this Pod. -For the template's [restart policy](/docs/concepts/workloads/Pods/pod-lifecycle/#restart-policy) field, +For the template's [restart policy](/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy) field, `.spec.template.spec.restartPolicy`, the only allowed value is `Always`, which is the default. --> ### Pod 模版 diff --git a/content/zh/docs/concepts/workloads/controllers/replicationcontroller.md b/content/zh/docs/concepts/workloads/controllers/replicationcontroller.md index dee9e01912..c35032aa28 100644 --- a/content/zh/docs/concepts/workloads/controllers/replicationcontroller.md +++ b/content/zh/docs/concepts/workloads/controllers/replicationcontroller.md @@ -174,10 +174,10 @@ nginx-3ntk0 nginx-4ok8v nginx-qrm3m 这里,选择算符与 ReplicationController 的选择算符相同(参见 `kubectl describe` 输出),并以不同的形式出现在 `replication.yaml` 中。 -`--output=jsonpath` 选项指定了一个表达式,只从返回列表中的每个 Pod 中获取名称。 +`--output=jsonpath` 选项指定了一个表达式,仅从返回列表中的每个 Pod 中获取名称。 ## 使用 ReplicationController {#working-with-replicationcontrollers} @@ -317,16 +317,17 @@ When using the REST API or go client library, you need to do the steps explicitl kubectl 将 ReplicationController 缩放为 0 并等待以便在删除 ReplicationController 本身之前删除每个 Pod。 如果这个 kubectl 命令被中断,可以重新启动它。 -当使用 REST API 或 go 客户端库时,你需要明确地执行这些步骤(缩放副本为 0、 等待 Pod 删除,之后删除 ReplicationController 资源)。 +当使用 REST API 或 Go 客户端库时,你需要明确地执行这些步骤(缩放副本为 0、 +等待 Pod 删除,之后删除 ReplicationController 资源)。 ### 只删除 ReplicationController @@ -334,7 +335,7 @@ When using the REST API or go client library, simply delete the ReplicationContr 使用 kubectl,为 [`kubectl delete`](/docs/reference/generated/kubectl/kubectl-commands#delete) 指定 `--cascade=false` 选项。 -当使用 REST API 或 go 客户端库时,只需删除 ReplicationController 对象。 +当使用 REST API 或 Go 客户端库时,只需删除 ReplicationController 对象。 ### 扩缩容 {#scaling} -通过简单地更新 `replicas` 字段,ReplicationController 可以方便地横向扩容或缩容副本的数量,或手动或通过自动缩放控制代理。 +通过设置 `replicas` 字段,ReplicationController 可以方便地横向扩容或缩容副本的数量。 +你可以手动或通过自动缩放控制代理来控制 ReplicationController 执行此操作。 ## ReplicationController 的职责 -ReplicationController 只需确保所需的 Pod 数量与其标签选择算符匹配,并且是可操作的。 +ReplicationController 仅确保所需的 Pod 数量与其标签选择算符匹配,并且是可操作的。 目前,它的计数中只排除终止的 Pod。 未来,可能会考虑系统提供的[就绪状态](https://issue.k8s.io/620)和其他信息, 我们可能会对替换策略添加更多控制,