@@ -45,12 +45,12 @@ following Kubernetes concepts:
45
45
* [StatefulSets](/docs/concepts/workloads/controllers/statefulset/)
46
46
* The [kubectl](/docs/reference/kubectl/kubectl/) command line tool
47
47
-->
48
- * [ Pods ] ( /zh-cn/docs/concepts/workloads/pods/ )
48
+ * [ Pod ] ( /zh-cn/docs/concepts/workloads/pods/ )
49
49
* [ Cluster DNS] ( /zh-cn/docs/concepts/services-networking/dns-pod-service/ )
50
- * [ Headless Services ] ( /zh-cn/docs/concepts/services-networking/service/#headless-services )
50
+ * [ Headless Service ] ( /zh-cn/docs/concepts/services-networking/service/#headless-services )
51
51
* [ PersistentVolumes] ( /zh-cn/docs/concepts/storage/persistent-volumes/ )
52
52
* [ PersistentVolume Provisioning] ( https://github.com/kubernetes/examples/tree/master/staging/persistent-volume-provisioning/ )
53
- * [ StatefulSets ] ( /zh-cn/docs/concepts/workloads/controllers/statefulset/ )
53
+ * [ StatefulSet ] ( /zh-cn/docs/concepts/workloads/controllers/statefulset/ )
54
54
* [ kubectl] ( /zh-cn/docs/reference/kubectl/kubectl/ ) 命令行工具
55
55
56
56
{{< note >}}
@@ -75,7 +75,7 @@ topic with the latter, you will deploy a simple web application using a Stateful
75
75
-->
76
76
StatefulSet 旨在与有状态的应用及分布式系统一起使用。然而在 Kubernetes
77
77
上管理有状态应用和分布式系统是一个宽泛而复杂的话题。
78
- 为了演示 StatefulSet 的基本特性,并且不使前后的主题混淆,你将会使用 StatefulSet 部署一个简单的 web 应用。
78
+ 为了演示 StatefulSet 的基本特性,并且不使前后的主题混淆,你将会使用 StatefulSet 部署一个简单的 Web 应用。
79
79
80
80
<!--
81
81
After this tutorial, you will be familiar with the following.
@@ -189,7 +189,7 @@ created sequentially, ordered from _{0..n-1}_. Examine the output of the
189
189
`kubectl get` command in the first terminal. Eventually, the output will
190
190
look like the example below.
191
191
-->
192
- 对于一个拥有 _ n _ 个副本的 StatefulSet,Pod 被部署时是按照 _ {0..n-1}_ 的序号顺序创建的。
192
+ 对于一个拥有 ** n ** 个副本的 StatefulSet,Pod 被部署时是按照 ** {0..n-1}** 的序号顺序创建的。
193
193
在第一个终端中使用 ` kubectl get ` 检查输出。这个输出最终将看起来像下面的样子。
194
194
195
195
``` shell
@@ -212,9 +212,9 @@ Notice that the `web-1` Pod is not launched until the `web-0` Pod is
212
212
_Running_ (see [Pod Phase](/docs/concepts/workloads/pods/pod-lifecycle/#pod-phase))
213
213
and _Ready_ (see `type` in [Pod Conditions](/docs/concepts/workloads/pods/pod-lifecycle/#pod-conditions)).
214
214
-->
215
- 请注意,直到 ` web-0 ` Pod 处于 _ Running _ (请参阅
215
+ 请注意,直到 ` web-0 ` Pod 处于 ** Running ** (请参阅
216
216
[ Pod 阶段] ( /zh-cn/docs/concepts/workloads/pods/pod-lifecycle/#pod-phase ) )
217
- 并 _ Ready _ (请参阅 [ Pod 状况] ( /zh-cn/docs/concepts/workloads/pods/pod-lifecycle/#pod-conditions ) 中的
217
+ 并 ** Ready ** (请参阅 [ Pod 状况] ( /zh-cn/docs/concepts/workloads/pods/pod-lifecycle/#pod-conditions ) 中的
218
218
` type ` )状态后,` web-1 ` Pod 才会被启动。
219
219
220
220
<!--
@@ -259,7 +259,7 @@ StatefulSet 中的每个 Pod 拥有一个具有黏性的、独一无二的身份
259
259
这个标志基于 StatefulSet
260
260
{{< glossary_tooltip term_id="controller" text="控制器">}}分配给每个
261
261
Pod 的唯一顺序索引。
262
- Pod 的名称的形式为 ` <statefulset 名称>-<序号索引> ` 。
262
+ Pod 名称的格式为 ` <statefulset 名称>-<序号索引> ` 。
263
263
` web ` StatefulSet 拥有两个副本,所以它创建了两个 Pod:` web-0 ` 和 ` web-1 ` 。
264
264
265
265
<!--
@@ -292,7 +292,7 @@ addresses:
292
292
-->
293
293
使用 [ ` kubectl run ` ] ( /docs/reference/generated/kubectl/kubectl-commands/#run )
294
294
运行一个提供 ` nslookup ` 命令的容器,该命令来自于 ` dnsutils ` 包。
295
- 通过对 Pod 的主机名执行 ` nslookup ` ,你可以检查他们在集群内部的 DNS 地址:
295
+ 通过对 Pod 的主机名执行 ` nslookup ` ,你可以检查这些主机名在集群内部的 DNS 地址:
296
296
297
297
``` shell
298
298
kubectl run -i --tty --image busybox:1.28 dns-test --restart=Never --rm
@@ -304,7 +304,7 @@ which starts a new shell. In that new shell, run:
304
304
这将启动一个新的 Shell。在新 Shell 中运行:
305
305
306
306
``` shell
307
- # Run this in the dns-test container shell
307
+ # 在 dns-test 容器 Shell 中运行以下命令
308
308
nslookup web-0.nginx
309
309
```
310
310
@@ -418,7 +418,7 @@ In that new shell, run:
418
418
这将启动一个新的 Shell。在新 Shell 中,运行:
419
419
420
420
``` shell
421
- # Run this in the dns-test container shell
421
+ # 在 dns-test 容器 Shell 中运行以下命令
422
422
nslookup web-0.nginx
423
423
```
424
424
@@ -477,7 +477,7 @@ to Running and Ready.
477
477
-->
478
478
如果你的应用已经实现了用于测试是否已存活(liveness)并就绪(readiness)的连接逻辑,
479
479
你可以使用 Pod 的 SRV 记录(` web-0.nginx.default.svc.cluster.local ` 、
480
- ` web-1.nginx.default.svc.cluster.local ` )。因为他们是稳定的 ,并且当你的
480
+ ` web-1.nginx.default.svc.cluster.local ` )。因为它们是稳定的 ,并且当你的
481
481
Pod 的状态变为 Running 和 Ready 时,你的应用就能够发现它们的地址。
482
482
483
483
<!--
@@ -558,15 +558,14 @@ by running:
558
558
-->
559
559
请注意,如果你看见上面的 curl 命令返回了 ** 403 Forbidden** 的响应,你需要像这样修复使用 ` volumeMounts `
560
560
(原因归咎于[ 使用 hostPath 卷时存在的缺陷] ( https://github.com/kubernetes/kubernetes/issues/2630 ) )
561
- 挂载的目录的权限
562
- 运行:
561
+ 挂载的目录的权限,先运行:
563
562
564
563
` for i in 0 1; do kubectl exec web-$i -- chmod 755 /usr/share/nginx/html; done `
565
564
566
565
<!--
567
566
before retrying the `curl` command above.
568
567
-->
569
- 在你重新尝试上面的 ` curl ` 命令之前 。
568
+ 再重新尝试上面的 ` curl ` 命令 。
570
569
{{< /note >}}
571
570
572
571
<!--
@@ -793,7 +792,6 @@ www-web-1 Bound pvc-15c79307-b507-11e6-932f-42010a800002 1Gi RWO
793
792
www-web-2 Bound pvc-e1125b27-b508-11e6-932f-42010a800002 1Gi RWO 13h
794
793
www-web-3 Bound pvc-e1176df6-b508-11e6-932f-42010a800002 1Gi RWO 13h
795
794
www-web-4 Bound pvc-e11bb5f8-b508-11e6-932f-42010a800002 1Gi RWO 13h
796
-
797
795
```
798
796
799
797
<!--
@@ -947,7 +945,6 @@ for p in 0 1 2; do kubectl get pod "web-$p" --template '{{range $i, $c := .spec.
947
945
k8s.gcr.io/nginx-slim:0.8
948
946
k8s.gcr.io/nginx-slim:0.8
949
947
k8s.gcr.io/nginx-slim:0.8
950
-
951
948
```
952
949
953
950
<!--
@@ -982,7 +979,7 @@ StatefulSet 的 `.spec.template`。
982
979
<!--
983
980
Patch the `web` StatefulSet to add a partition to the `updateStrategy` field:
984
981
-->
985
- 对 ` web ` StatefulSet 执行 Patch 操作以为 ` updateStrategy ` 字段添加一个分区:
982
+ 对 ` web ` StatefulSet 执行 Patch 操作为 ` updateStrategy ` 字段添加一个分区:
986
983
987
984
``` shell
988
985
kubectl patch statefulset web -p ' {"spec":{"updateStrategy":{"type":"RollingUpdate","rollingUpdate":{"partition":3}}}}'
@@ -1102,7 +1099,6 @@ kubectl get pod web-2 --template '{{range $i, $c := .spec.containers}}{{$c.image
1102
1099
```
1103
1100
```
1104
1101
k8s.gcr.io/nginx-slim:0.7
1105
-
1106
1102
```
1107
1103
1108
1104
<!--
@@ -1393,7 +1389,7 @@ service/nginx unchanged
1393
1389
Ignore the error. It only indicates that an attempt was made to create the _nginx_
1394
1390
headless Service even though that Service already exists.
1395
1391
-->
1396
- 请忽略这个错误。它仅表示 kubernetes 进行了一次创建 _ nginx _ headless Service
1392
+ 请忽略这个错误。它仅表示 kubernetes 进行了一次创建 ** nginx ** headless Service
1397
1393
的尝试,尽管那个 Service 已经存在。
1398
1394
1399
1395
<!--
@@ -1509,7 +1505,6 @@ web-0 0/1 Terminating 0 12m
1509
1505
web-1 0/1 Terminating 0 29m
1510
1506
web-1 0/1 Terminating 0 29m
1511
1507
web-1 0/1 Terminating 0 29m
1512
-
1513
1508
```
1514
1509
1515
1510
<!--
@@ -1518,7 +1513,7 @@ are terminated one at a time, with respect to the reverse order of their ordinal
1518
1513
indices. Before terminating a Pod, the StatefulSet controller waits for
1519
1514
the Pod's successor to be completely terminated.
1520
1515
-->
1521
- 如同你在[ 缩容] ( #ordered-pod-termination ) 一节看到的, Pod 按照和他们序号索引相反的顺序每次终止一个 。
1516
+ 如同你在[ 缩容] ( #scaling-down ) 章节看到的,这些 Pod 按照与其序号索引相反的顺序每次终止一个 。
1522
1517
在终止一个 Pod 前,StatefulSet 控制器会等待 Pod 后继者被完全终止。
1523
1518
1524
1519
{{< note >}}
@@ -1803,7 +1798,6 @@ Service:
1803
1798
kubectl delete svc nginx
1804
1799
```
1805
1800
1806
-
1807
1801
{{< note >}}
1808
1802
<!--
1809
1803
You also need to delete the persistent storage media for the PersistentVolumes
@@ -1815,5 +1809,5 @@ used in this tutorial.
1815
1809
Follow the necessary steps, based on your environment, storage configuration,
1816
1810
and provisioning method, to ensure that all storage is reclaimed.
1817
1811
-->
1818
- 基于你的环境、存储配置和制备方式,按照必须的步骤保证回收所有的存储 。
1819
- {{< /note >}}
1812
+ 基于你的环境、存储配置和制备方式,按照必需的步骤保证回收所有的存储 。
1813
+ {{< /note >}}
0 commit comments