@@ -215,7 +215,7 @@ The StatefulSet controller creates three Pods, and each Pod has a container with
215
215
a [ZooKeeper](https://www-us.apache.org/dist/zookeeper/stable/) server.
216
216
-->
217
217
StatefulSet 控制器创建 3 个 Pods,每个 Pod 包含一个
218
- [ ZooKeeper] ( https://www-us.apache.org/dist/zookeeper/stable/ ) 服务器 。
218
+ [ ZooKeeper] ( https://www-us.apache.org/dist/zookeeper/stable/ ) 服务容器 。
219
219
220
220
<!--
221
221
### Facilitating Leader Election
@@ -670,10 +670,10 @@ The `volumeMounts` section of the `StatefulSet`'s container `template` mounts th
670
670
StatefulSet 的容器 `template` 中的 `volumeMounts` 一节使得
671
671
PersistentVolumes 被挂载到 ZooKeeper 服务器的数据目录。
672
672
673
- ```shell
673
+ ```yaml
674
674
volumeMounts:
675
- - name: datadir
676
- mountPath: /var/lib/zookeeper
675
+ - name: datadir
676
+ mountPath: /var/lib/zookeeper
677
677
```
678
678
679
679
<!--
@@ -682,7 +682,7 @@ same `PersistentVolume` mounted to the ZooKeeper server's data directory.
682
682
Even when the Pods are rescheduled, all the writes made to the ZooKeeper
683
683
servers' WALs, and all their snapshots, remain durable.
684
684
-->
685
- 当 ` zk ` StatefulSet 中的一个 Pod 被(重新)调度时,它总是拥有相同的 PersistentVolume,
685
+ 当 ` zk ` ` StatefulSet ` 中的一个 Pod 被(重新)调度时,它总是拥有相同的 PersistentVolume,
686
686
挂载到 ZooKeeper 服务器的数据目录。
687
687
即使在 Pods 被重新调度时,所有对 ZooKeeper 服务器的 WALs 的写入和它们的
688
688
全部快照都仍然是持久的。
@@ -1110,17 +1110,17 @@ The Pod `template` for the `zk` `StatefulSet` specifies a liveness probe.
1110
1110
许多场景下,一个系统进程可以是活动状态但不响应请求,或者是不健康状态。
1111
1111
你应该使用存活性探针来通知 Kubernetes 你的应用进程处于不健康状态,需要被重启。
1112
1112
1113
- ` zk ` StatefulSet 的 Pod 的 ` template ` 一节指定了一个存活探针。
1113
+ ` zk ` ` StatefulSet ` 的 Pod 的 ` template ` 一节指定了一个存活探针。
1114
1114
1115
1115
``` yaml
1116
- livenessProbe :
1117
- exec :
1118
- command :
1119
- - sh
1120
- - -c
1121
- - " zookeeper-ready 2181"
1122
- initialDelaySeconds : 15
1123
- timeoutSeconds : 5
1116
+ livenessProbe :
1117
+ exec :
1118
+ command :
1119
+ - sh
1120
+ - -c
1121
+ - " zookeeper-ready 2181"
1122
+ initialDelaySeconds : 15
1123
+ timeoutSeconds : 5
1124
1124
` ` `
1125
1125
1126
1126
<!--
@@ -1249,7 +1249,7 @@ By default, Kubernetes may co-locate Pods in a `StatefulSet` on the same node.
1249
1249
For the three server ensemble you created, if two servers are on the same node, and that node fails,
1250
1250
the clients of your ZooKeeper service will experience an outage until at least one of the Pods can be rescheduled.
1251
1251
-->
1252
- 默认情况下,Kubernetes 可以把 StatefulSet 的 Pods 部署在相同节点上。
1252
+ 默认情况下,Kubernetes 可以把 ` StatefulSet` 的 Pods 部署在相同节点上。
1253
1253
对于你创建的 3 个服务器的 ensemble 来说,如果有两个服务器并存于
1254
1254
相同的节点上并且该节点发生故障时,ZooKeeper 服务将中断,
1255
1255
直至至少一个 Pods 被重新调度。
@@ -1268,7 +1268,7 @@ Use the command below to get the nodes for Pods in the `zk` `StatefulSet`.
1268
1268
ZooKeeper 服务器为止。
1269
1269
但是,如果希望你的服务在容忍节点故障时无停服时间,你应该设置 `podAntiAffinity`。
1270
1270
1271
- 获取 `zk` Stateful Set 中的 Pods 的节点。
1271
+ 使用下面的命令获取 `zk` `StatefulSet` 中的 Pods 的节点。
1272
1272
1273
1273
` ` ` shell
1274
1274
for i in 0 1 2; do kubectl get pod zk-$i --template {{.spec.nodeName}}; echo ""; done
@@ -1450,7 +1450,7 @@ zk-0 1/1 Running 0 1m
1450
1450
Keep watching the `StatefulSet`'s Pods in the first terminal and drain the node on which
1451
1451
`zk-1` is scheduled.
1452
1452
-->
1453
- 在第一个终端中持续观察 StatefulSet 的 Pods 并腾空 ` zk-1 ` 调度所在的节点。
1453
+ 在第一个终端中持续观察 ` StatefulSet ` 的 Pods 并腾空 ` zk-1 ` 调度所在的节点。
1454
1454
1455
1455
``` shell
1456
1456
kubectl drain $( kubectl get pod zk-1 --template {{.spec.nodeName}}) --ignore-daemonsets --force -delete-emptydir-data " kubernetes-node-ixsl" cordoned
@@ -1467,7 +1467,7 @@ The `zk-1` Pod cannot be scheduled because the `zk` `StatefulSet` contains a `Po
1467
1467
co-location of the Pods, and as only two nodes are schedulable, the Pod will remain in a Pending state.
1468
1468
-->
1469
1469
` zk-1 ` Pod 不能被调度,这是因为 ` zk ` ` StatefulSet ` 包含了一个防止 Pods
1470
- 共存的 PodAntiAffinity 规则,而且只有两个节点可用于调度,
1470
+ 共存的 ` PodAntiAffinity ` 规则,而且只有两个节点可用于调度,
1471
1471
这个 Pod 将保持在 Pending 状态。
1472
1472
1473
1473
``` shell
@@ -1498,7 +1498,7 @@ zk-1 0/1 Pending 0 0s
1498
1498
```
1499
1499
1500
1500
<!--
1501
- Continue to watch the Pods of the stateful set , and drain the node on which
1501
+ Continue to watch the Pods of the StatefulSet , and drain the node on which
1502
1502
`zk-2` is scheduled.
1503
1503
-->
1504
1504
继续观察 StatefulSet 中的 Pods 并腾空 ` zk-2 ` 调度所在的节点。
@@ -1522,7 +1522,7 @@ You cannot drain the third node because evicting `zk-2` would violate `zk-budget
1522
1522
1523
1523
Use `zkCli.sh` to retrieve the value you entered during the sanity test from `zk-0`.
1524
1524
-->
1525
- 使用 ` CRTL -C` 终止 kubectl。
1525
+ 使用 ` CTRL -C` 终止 kubectl。
1526
1526
1527
1527
你不能腾空第三个节点,因为驱逐 ` zk-2 ` 将和 ` zk-budget ` 冲突。
1528
1528
然而这个节点仍然处于隔离状态(Cordoned)。
@@ -1536,7 +1536,7 @@ kubectl exec zk-0 zkCli.sh get /hello
1536
1536
<!--
1537
1537
The service is still available because its `PodDisruptionBudget` is respected.
1538
1538
-->
1539
- 由于遵守了 PodDisruptionBudget,服务仍然可用。
1539
+ 由于遵守了 ` PodDisruptionBudget ` ,服务仍然可用。
1540
1540
1541
1541
```
1542
1542
WatchedEvent state:SyncConnected type:None path:null
0 commit comments