Skip to content

Commit 7813cdb

Browse files
authored
Merge pull request #42255 from my-git9/path-16696
[zh-cn] sync run-application/*
2 parents 004c8d3 + 8e6e3e9 commit 7813cdb

File tree

5 files changed

+52
-51
lines changed

5 files changed

+52
-51
lines changed

content/zh-cn/docs/tasks/run-application/configure-pdb.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ nodes.
3939
- 你是 Kubernetes 集群中某应用的所有者,该应用有高可用要求。
4040
- 你应了解如何部署[无状态应用](/zh-cn/docs/tasks/run-application/run-stateless-application-deployment/)
4141
和/或[有状态应用](/zh-cn/docs/tasks/run-application/run-replicated-stateful-application/)
42-
- 你应当已经阅读过关于 [Pod 干扰](/zh-cn/docs/concepts/workloads/pods/disruptions/) 的文档。
42+
- 你应当已经阅读过关于 [Pod 干扰](/zh-cn/docs/concepts/workloads/pods/disruptions/)的文档。
4343
- 用户应当与集群所有者或服务提供者确认其遵从 Pod 干扰预算(Pod Disruption Budgets)的规则。
4444

4545
<!-- steps -->
@@ -54,7 +54,7 @@ nodes.
5454
-->
5555
## 用 PodDisruptionBudget 来保护应用 {#protecting-app-with-pdb}
5656

57-
1. 确定想要使用 PodDisruptionBudget (PDB) 来保护的应用。
57+
1. 确定想要使用 PodDisruptionBudgetPDB来保护的应用。
5858
1. 考虑应用对干扰的反应。
5959
1. 以 YAML 文件形式定义 PDB。
6060
1. 通过 YAML 文件创建 PDB 对象。
@@ -146,7 +146,7 @@ due to a voluntary disruption.
146146
(允许同时出现更多的干扰)。
147147
- 可重新启动的批处理任务:
148148
- 关注:自发干扰的情况下,需要确保任务完成。
149-
- 可能的解决方案:不创建 PDB。 任务控制器会创建一个替换 Pod。
149+
- 可能的解决方案:不创建 PDB。任务控制器会创建一个替换 Pod。
150150

151151
<!--
152152
### Rounding logic when specifying percentages
@@ -221,8 +221,8 @@ PodDisruptionBudgets. For policy/v1beta1 an empty selector matches zero pods, wh
221221
for policy/v1 an empty selector matches every pod in the namespace.
222222
-->
223223
`policy/v1beta1``policy/v1` API 中 PodDisruptionBudget 的空选择算符的行为
224-
略有不同。在 `policy/v1beta1` 中,空的选择算符不会匹配任何 Pods,而
225-
`policy/v1` 中,空的选择算符会匹配名字空间中所有 Pods
224+
略有不同。在 `policy/v1beta1` 中,空的选择算符不会匹配任何 Pod,而
225+
`policy/v1` 中,空的选择算符会匹配名字空间中所有 Pod
226226
{{< /note >}}
227227

228228
<!--
@@ -235,7 +235,7 @@ is the `scale` of the controller managing the pods being selected by the
235235
用户在同一个 `PodDisruptionBudget` 中只能够指定 `maxUnavailable``minAvailable` 中的一个。
236236
`maxUnavailable` 只能够用于控制存在相应控制器的 Pod 的驱逐(即不受控制器控制的 Pod 不在
237237
`maxUnavailable` 控制范围内)。在下面的示例中,
238-
“所需副本” 指的是相应控制器的 `scale`,控制器对 `PodDisruptionBudget` 所选择的 Pod 进行管理。
238+
“所需副本”指的是相应控制器的 `scale`,控制器对 `PodDisruptionBudget` 所选择的 Pod 进行管理。
239239

240240
<!--
241241
Example 1: With a `minAvailable` of 5, evictions are allowed as long as they leave behind
@@ -311,14 +311,14 @@ Example PDB Using minAvailable:
311311
-->
312312
使用 minAvailable 的 PDB 示例:
313313

314-
{{< codenew file="policy/zookeeper-pod-disruption-budget-minavailable.yaml" >}}
314+
{{% codenew file="policy/zookeeper-pod-disruption-budget-minavailable.yaml" %}}
315315

316316
<!--
317317
Example PDB Using maxUnavailable:
318318
-->
319319
使用 maxUnavailable 的 PDB 示例:
320320

321-
{{< codenew file="policy/zookeeper-pod-disruption-budget-maxunavailable.yaml" >}}
321+
{{% codenew file="policy/zookeeper-pod-disruption-budget-maxunavailable.yaml" %}}
322322

323323
<!--
324324
For example, if the above `zk-pdb` object selects the pods of a StatefulSet of size 3, both
@@ -368,7 +368,7 @@ zk-pdb 2 N/A 0 7s
368368
<!--
369369
If there are matching pods (say, 3), then you would see something like this:
370370
-->
371-
假设有匹配的 Pod (比如说 3 个), 那么用户会看到类似下面的信息:
371+
假设有匹配的 Pod比如说 3 个),那么用户会看到类似下面的信息:
372372

373373
```shell
374374
kubectl get poddisruptionbudgets
@@ -477,7 +477,7 @@ Policies:
477477
(`.status.currentHealthy` 至少等于 `.status.desiredHealthy`)时才能被驱逐。
478478

479479
: 此策略确保已受干扰的应用程序所运行的 Pod 会尽可能成为健康。
480-
这对排空节点有负面影响,可能会因 PDB 守护的应用程序行为错误而阻止排空
480+
这对腾空节点有负面影响,可能会因 PDB 守护的应用程序行为错误而阻止腾空
481481
更具体地说,这些应用程序的 Pod 处于 `CrashLoopBackOff` 状态
482482
(由于漏洞或错误配置)或其 Pod 只是未能报告 `Ready` 状况。
483483

@@ -505,7 +505,7 @@ Policies:
505505
<!--
506506
Pods in `Pending`, `Succeeded` or `Failed` phase are always considered for eviction.
507507
-->
508-
处于`Pending`、`Succeeded` 或 `Failed` 阶段的 Pod 总是被考虑驱逐。
508+
处于 `Pending`、`Succeeded` 或 `Failed` 阶段的 Pod 总是被考虑驱逐。
509509
{{< /note >}}
510510

511511
<!--
@@ -535,7 +535,7 @@ You can use a PDB with pods controlled by another resource, by an
535535
- only `.spec.minAvailable` can be used, not `.spec.maxUnavailable`.
536536
- only an integer value can be used with `.spec.minAvailable`, not a percentage.
537537
-->
538-
- 只能够使用 `.spec.minAvailable` ,而不能够使用 `.spec.maxUnavailable。`
538+
- 只能够使用 `.spec.minAvailable`,而不能够使用 `.spec.maxUnavailable。`
539539
- 只能够使用整数作为 `.spec.minAvailable` 的值,而不能使用百分比。
540540

541541
<!--
@@ -551,4 +551,4 @@ PDBs is when pods are being transitioned from one PDB to another.
551551

552552
你可以使用能够选择属于工作负载资源的 Pod 的子集或超集的选择算符。
553553
驱逐 API 将不允许驱逐被多个 PDB 覆盖的任何 Pod,因此大多数用户都希望避免重叠的选择算符。
554-
重叠 PDB 的一种合理用途是将 Pod 从一个 PDB 转交到另一个 PDB 的场合。
554+
重叠 PDB 的一种合理用途是将 Pod 从一个 PDB 转交到另一个 PDB 的场合。

content/zh-cn/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ running for the workload.
3939
目的是自动扩缩工作负载以满足需求。
4040

4141
水平扩缩意味着对增加的负载的响应是部署更多的 {{< glossary_tooltip text="Pod" term_id="pod" >}}。
42-
这与 “垂直(Vertical)” 扩缩不同,对于 Kubernetes,
42+
这与“垂直(Vertical)”扩缩不同,对于 Kubernetes,
4343
垂直扩缩意味着将更多资源(例如:内存或 CPU)分配给已经为工作负载运行的 Pod。
4444

4545
<!--
@@ -104,7 +104,7 @@ using the following manifest:
104104
为了演示 HorizontalPodAutoscaler,你将首先启动一个 Deployment 用 `hpa-example` 镜像运行一个容器,
105105
然后使用以下清单文件将其暴露为一个 {{< glossary_tooltip term_id="service">}}:
106106

107-
{{< codenew file="application/php-apache.yaml" >}}
107+
{{% codenew file="application/php-apache.yaml" %}}
108108

109109
<!--
110110
To do so, run the following command:
@@ -415,7 +415,7 @@ the only other supported resource metric is memory. These resources do not chan
415415
to cluster, and should always be available, as long as the `metrics.k8s.io` API is available.
416416
-->
417417
需要注意的是,`targetCPUUtilizationPercentage` 字段已经被名为 `metrics` 的数组所取代。
418-
CPU 利用率这个度量指标是一个 *resource metric*(资源度量指标),因为它表示容器上指定资源的百分比。
418+
CPU 利用率这个度量指标是一个 **resource metric**(资源度量指标),因为它表示容器上指定资源的百分比。
419419
除 CPU 外,你还可以指定其他资源度量指标。默认情况下,目前唯一支持的其他资源度量指标为内存。
420420
只要 `metrics.k8s.io` API 存在,这些资源度量指标就是可用的,并且他们不会在不同的 Kubernetes 集群中改变名称。
421421

@@ -433,7 +433,7 @@ There are two other types of metrics, both of which are considered *custom metri
433433
object metrics. These metrics may have names which are cluster specific, and require a more
434434
advanced cluster monitoring setup.
435435
-->
436-
还有两种其他类型的度量指标,他们被认为是 *custom metrics*(自定义度量指标):
436+
还有两种其他类型的度量指标,他们被认为是 **custom metrics**(自定义度量指标):
437437
即 Pod 度量指标和 Object 度量指标。
438438
这些度量指标可能具有特定于集群的名称,并且需要更高级的集群监控设置。
439439

@@ -444,7 +444,7 @@ They work much like resource metrics, except that they *only* support a `target`
444444
-->
445445
第一种可选的度量指标类型是 **Pod 度量指标**。这些指标从某一方面描述了 Pod,
446446
在不同 Pod 之间进行平均,并通过与一个目标值比对来确定副本的数量。
447-
它们的工作方式与资源度量指标非常相像,只是它们 **仅** 支持 `target` 类型为 `AverageValue`。
447+
它们的工作方式与资源度量指标非常相像,只是它们**仅**支持 `target` 类型为 `AverageValue`。
448448

449449
<!--
450450
Pod metrics are specified using a metric block like this:
@@ -589,7 +589,7 @@ label, you can specify the following metric block to scale only on GET requests:
589589
-->
590590
### 基于更特别的度量值来扩缩 {#autoscaing-on-more-specific-metrics}
591591

592-
许多度量流水线允许你通过名称或附加的 **标签** 来描述度量指标。
592+
许多度量流水线允许你通过名称或附加的**标签**来描述度量指标。
593593
对于所有非资源类型度量指标(Pod、Object 和后面将介绍的 External),
594594
可以额外指定一个标签选择算符。例如,如果你希望收集包含 `verb` 标签的
595595
`http_requests` 度量指标,可以按如下所示设置度量指标块,使得扩缩操作仅针对
@@ -735,7 +735,7 @@ HorizontalPodAutoscaler.
735735
-->
736736
对于上面展示的这个 HorizontalPodAutoscaler,我们可以看出有若干状态条件处于健康状态。
737737
首先,`AbleToScale` 表明 HPA 是否可以获取和更新扩缩信息,以及是否存在阻止扩缩的各种回退条件。
738-
其次,`ScalingActive` 表明 HPA 是否被启用(即目标的副本数量不为零) 以及是否能够完成扩缩计算。
738+
其次,`ScalingActive` 表明 HPA 是否被启用(即目标的副本数量不为零)以及是否能够完成扩缩计算。
739739
当这一状态为 `False` 时,通常表明获取度量指标存在问题。
740740
最后一个条件 `ScalingLimited` 表明所需扩缩的值被 HorizontalPodAutoscaler
741741
所定义的最大或者最小值所限制(即已经达到最大或者最小扩缩值)。
@@ -775,7 +775,7 @@ can use the following manifest to create it declaratively:
775775
-->
776776
除了使用 `kubectl autoscale` 命令,也可以使用以下清单以声明方式创建 HorizontalPodAutoscaler:
777777
778-
{{< codenew file="application/hpa/php-apache.yaml" >}}
778+
{{% codenew file="application/hpa/php-apache.yaml" %}}
779779
780780
<!--
781781
Then, create the autoscaler by executing the following command:

content/zh-cn/docs/tasks/run-application/run-replicated-stateful-application.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Create the ConfigMap from the following YAML configuration file:
9898

9999
使用以下的 YAML 配置文件创建 ConfigMap :
100100

101-
{{< codenew file="application/mysql/mysql-configmap.yaml" >}}
101+
{{% codenew file="application/mysql/mysql-configmap.yaml" %}}
102102

103103
```shell
104104
kubectl apply -f https://k8s.io/examples/application/mysql/mysql-configmap.yaml
@@ -132,7 +132,7 @@ Create the Services from the following YAML configuration file:
132132

133133
使用以下 YAML 配置文件创建服务:
134134

135-
{{< codenew file="application/mysql/mysql-services.yaml" >}}
135+
{{% codenew file="application/mysql/mysql-services.yaml" %}}
136136

137137
```shell
138138
kubectl apply -f https://k8s.io/examples/application/mysql/mysql-services.yaml

content/zh-cn/docs/tasks/run-application/run-single-instance-stateful-application.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ This page shows you how to run a single-instance stateful application
1111
in Kubernetes using a PersistentVolume and a Deployment. The
1212
application is MySQL.
1313
-->
14-
本文介绍在 Kubernetes 中如何使用 PersistentVolume 和 Deployment 运行一个单实例有状态应用。该应用是 MySQL.
14+
本文介绍在 Kubernetes 中如何使用 PersistentVolume 和 Deployment 运行一个单实例有状态应用。
15+
该示例应用是 MySQL。
1516

1617
## {{% heading "objectives" %}}
1718

@@ -20,9 +21,9 @@ application is MySQL.
2021
* Create a MySQL Deployment.
2122
* Expose MySQL to other pods in the cluster at a known DNS name.
2223
-->
23-
* 在你的环境中创建一个引用磁盘的 PersistentVolume
24-
* 创建一个 MySQL Deployment.
25-
* 在集群内以一个已知的 DNS 名称将 MySQL 暴露给其他 Pod
24+
* 在你的环境中创建一个引用磁盘的 PersistentVolume
25+
* 创建一个 MySQL Deployment
26+
* 在集群内以一个已知的 DNS 名称将 MySQL 暴露给其他 Pod
2627

2728
## {{% heading "prerequisites" %}}
2829

@@ -44,9 +45,9 @@ satisfied by any existing volume that meets the requirements,
4445
or by a dynamic provisioner.
4546
-->
4647
你可以通过创建一个 Kubernetes Deployment 并使用 PersistentVolumeClaim 将其连接到
47-
某已有的 PV 卷来运行一个有状态的应用
48-
例如,这里的 YAML 描述的是一个运行 MySQL 的 Deployment,其中引用了 PVC 申领
49-
文件为 /var/lib/mysql 定义了加载卷,并创建了一个 PVC 申领,寻找一个 20G 大小的卷。
48+
某已有的 PersistentVolume 来运行一个有状态的应用
49+
例如,这里的 YAML 描述的是一个运行 MySQL 的 Deployment,其中引用了 PersistentVolumeClaim
50+
文件为 /var/lib/mysql 定义了卷挂载,并创建了一个 PersistentVolumeClaim,寻找一个 20G 大小的卷。
5051
该申领可以通过现有的满足需求的卷来满足,也可以通过动态供应卷的机制来满足。
5152

5253
<!--
@@ -55,10 +56,10 @@ Note: The password is defined in the config yaml, and this is insecure. See
5556
for a secure solution.
5657
-->
5758
注意:在配置的 YAML 文件中定义密码的做法是不安全的。具体安全解决方案请参考
58-
[Kubernetes Secrets](/zh-cn/docs/concepts/configuration/secret/).
59+
[Kubernetes Secrets](/zh-cn/docs/concepts/configuration/secret/)
5960

60-
{{< codenew file="application/mysql/mysql-deployment.yaml" >}}
61-
{{< codenew file="application/mysql/mysql-pv.yaml" >}}
61+
{{% codenew file="application/mysql/mysql-deployment.yaml" %}}
62+
{{% codenew file="application/mysql/mysql-pv.yaml" %}}
6263

6364
<!--
6465
1. Deploy the PV and PVC of the YAML file:
@@ -81,7 +82,7 @@ for a secure solution.
8182
<!--
8283
1. Display information about the Deployment:
8384
-->
84-
3. 展示 Deployment 相关信息:
85+
3. 展示 Deployment 相关信息
8586

8687
```shell
8788
kubectl describe deployment mysql
@@ -133,7 +134,7 @@ for a secure solution.
133134
<!--
134135
1. List the pods created by the Deployment:
135136
-->
136-
4. 列举出 Deployment 创建的 pods:
137+
4. 列举出 Deployment 创建的 Pod:
137138

138139
```shell
139140
kubectl get pods -l app=mysql
@@ -190,11 +191,11 @@ Run a MySQL client to connect to the server:
190191
-->
191192
## 访问 MySQL 实例 {#accessing-the-mysql-instance}
192193

193-
前面 YAML 文件中创建了一个允许集群内其他 Pod 访问的数据库服务。该服务中选项
194-
`clusterIP: None` 让服务 DNS 名称直接解析为 Pod 的 IP 地址。
195-
当在一个服务下只有一个 Pod 并且不打算增加 Pod 的数量这是最好的.
194+
前面 YAML 文件中创建了一个允许集群内其他 Pod 访问的数据库 Service。该 Service 中选项
195+
`clusterIP: None` 让 Service 的 DNS 名称直接解析为 Pod 的 IP 地址。
196+
当在一个 Service 下只有一个 Pod 并且不打算增加 Pod 的数量这是最好的
196197

197-
运行 MySQL 客户端以连接到服务器:
198+
运行 MySQL 客户端以连接到服务器
198199

199200
```shell
200201
kubectl run -it --rm --image=mysql:5.6 --restart=Never mysql-client -- mysql -h mysql -ppassword
@@ -225,7 +226,7 @@ specific to stateful apps:
225226
## 更新 {#updating}
226227

227228
Deployment 中镜像或其他部分同往常一样可以通过 `kubectl apply` 命令更新。
228-
以下是特定于有状态应用的一些注意事项:
229+
以下是特定于有状态应用的一些注意事项
229230

230231
<!--
231232
* Don't scale the app. This setup is for single-instance apps
@@ -240,11 +241,10 @@ Deployment 中镜像或其他部分同往常一样可以通过 `kubectl apply`
240241
-->
241242
* 不要对应用进行规模扩缩。这里的设置仅适用于单实例应用。下层的 PersistentVolume
242243
仅只能挂载到一个 Pod 上。对于集群级有状态应用,请参考
243-
[StatefulSet 文档](/zh-cn/docs/concepts/workloads/controllers/statefulset/).
244+
[StatefulSet 文档](/zh-cn/docs/concepts/workloads/controllers/statefulset/)
244245
* 在 Deployment 的 YAML 文件中使用 `strategy:` `type: Recreate`
245-
该选项指示 Kubernetes __ 使用滚动升级。滚动升级无法工作,因为这里一次不能
246-
运行多个 Pod。在使用更新的配置文件创建新的 Pod 前,`Recreate` 策略将
247-
保证先停止第一个 Pod。
246+
该选项指示 Kubernetes ****使用滚动升级。滚动升级无法工作,因为这里一次不能运行多个
247+
Pod。在使用更新的配置文件创建新的 Pod 前,`Recreate` 策略将保证先停止第一个 Pod。
248248

249249
<!--
250250
## Deleting a deployment
@@ -253,7 +253,7 @@ Delete the deployed objects by name:
253253
-->
254254
## 删除 Deployment {#deleting-a-deployment}
255255

256-
通过名称删除部署的对象:
256+
通过名称删除部署的对象
257257

258258
```shell
259259
kubectl delete deployment,svc mysql
@@ -269,7 +269,7 @@ PersistentVolume when it sees that you deleted the PersistentVolumeClaim.
269269
Some dynamic provisioners (such as those for EBS and PD) also release the
270270
underlying resource upon deleting the PersistentVolume.
271271
-->
272-
如果通过手动的方式供应 PersistentVolume, 那么也需要手动删除它以释放下层资源。
272+
如果通过手动的方式供应 PersistentVolume那么也需要手动删除它以释放下层资源。
273273
如果是用动态供应方式创建的 PersistentVolume,在删除 PersistentVolumeClaim 后
274274
PersistentVolume 将被自动删除。
275275
一些存储服务(比如 EBS 和 PD)也会在 PersistentVolume 被删除时自动回收下层资源。
@@ -286,6 +286,7 @@ PersistentVolume 将被自动删除。
286286
* [Volumes](/docs/concepts/storage/volumes/) and [Persistent Volumes](/docs/concepts/storage/persistent-volumes/)
287287
-->
288288
* 欲进一步了解 Deployment 对象,请参考 [Deployment 对象](/zh-cn/docs/concepts/workloads/controllers/deployment/)
289+
289290
* 进一步了解[部署应用](/zh-cn/docs/tasks/run-application/run-stateless-application-deployment/)
290291

291292
* 参阅 [kubectl run 文档](/docs/reference/generated/kubectl/kubectl-commands/#run)

content/zh-cn/docs/tasks/run-application/run-stateless-application-deployment.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ a Deployment that runs the nginx:1.14.2 Docker image:
3939
## 创建并了解一个 nginx Deployment
4040

4141
你可以通过创建一个 Kubernetes Deployment 对象来运行一个应用, 且你可以在一个
42-
YAML 文件中描述 Deployment。例如, 下面这个 YAML 文件描述了一个运行 nginx:1.14.2
42+
YAML 文件中描述 Deployment。例如下面这个 YAML 文件描述了一个运行 nginx:1.14.2
4343
Docker 镜像的 Deployment:
4444

45-
{{< codenew file="application/deployment.yaml" >}}
45+
{{% codenew file="application/deployment.yaml" %}}
4646

4747
<!--
4848
1. Create a Deployment based on the YAML file:
@@ -142,7 +142,7 @@ specifies that the deployment should be updated to use nginx 1.16.1.
142142
你可以通过应用一个新的 YAML 文件来更新 Deployment。下面的 YAML 文件指定该
143143
Deployment 镜像更新为 nginx 1.16.1。
144144

145-
{{< codenew file="application/deployment-update.yaml" >}}
145+
{{% codenew file="application/deployment-update.yaml" %}}
146146

147147
<!--
148148
1. Apply the new YAML file:
@@ -174,7 +174,7 @@ should have four Pods:
174174
你可以通过应用新的 YAML 文件来增加 Deployment 中 Pod 的数量。
175175
下面的 YAML 文件将 `replicas` 设置为 4,指定该 Deployment 应有 4 个 Pod:
176176

177-
{{< codenew file="application/deployment-scale.yaml" >}}
177+
{{% codenew file="application/deployment-scale.yaml" %}}
178178

179179
<!--
180180
1. Apply the new YAML file:
@@ -197,7 +197,7 @@ should have four Pods:
197197
<!--
198198
The output is similar to this:
199199
-->
200-
输出的结果类似于:
200+
输出的结果类似于
201201

202202
```
203203
NAME READY STATUS RESTARTS AGE

0 commit comments

Comments
 (0)