Skip to content

Commit 2471ced

Browse files
authored
[zh] sync and update statefulset.md
update based on English version of statefulset.md 1. added a block inside #stable-network-id 2. sync tables and blocks 3. added a sentence in #parallel-pod-management
1 parent d0a532e commit 2471ced

File tree

1 file changed

+51
-2
lines changed

1 file changed

+51
-2
lines changed

content/zh/docs/concepts/workloads/controllers/statefulset.md

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: StatefulSets
33
content_type: concept
4-
weight: 40
4+
weight: 30
55
---
66

77
<!--
@@ -146,15 +146,25 @@ spec:
146146
```
147147
148148
<!--
149+
In the above example:
150+
149151
* A Headless Service, named `nginx`, is used to control the network domain.
150152
* The StatefulSet, named `web`, has a Spec that indicates that 3 replicas of the nginx container will be launched in unique Pods.
151153
* The `volumeClaimTemplates` will provide stable storage using [PersistentVolumes](/docs/concepts/storage/persistent-volumes/) provisioned by a PersistentVolume Provisioner.
154+
155+
The name of a StatefulSet object must be a valid
156+
[DNS subdomain name](/docs/concepts/overview/working-with-objects/names#dns-subdomain-names).
157+
152158
-->
159+
上述例子中:
160+
153161
* 名为 `nginx` 的 Headless Service 用来控制网络域名。
154162
* 名为 `web` 的 StatefulSet 有一个 Spec,它表明将在独立的 3 个 Pod 副本中启动 nginx 容器。
155163
* `volumeClaimTemplates` 将通过 PersistentVolumes 驱动提供的
156164
[PersistentVolumes](/zh/docs/concepts/storage/persistent-volumes/) 来提供稳定的存储。
157165

166+
StatefulSet 的命名需要遵循 [DNS 子域名](zh/docs/concepts/overview/working-with-objects/names#dns-subdomain-names)。
167+
158168
<!--
159169
## Pod Selector
160170
-->
@@ -217,9 +227,46 @@ StatefulSet 可以使用 [无头服务](/zh/docs/concepts/services-networking/se
217227
一旦每个 Pod 创建成功,就会得到一个匹配的 DNS 子域,格式为:
218228
`$(pod 名称).$(所属服务的 DNS 域名)`,其中所属服务由 StatefulSet 的 `serviceName` 域来设定。
219229

230+
<!--
231+
Depending on how DNS is configured in your cluster, you may not be able to look up the DNS
232+
name for a newly-run Pod immediately. This behavior can occur when other clients in the
233+
cluster have already sent queries for the hostname of the Pod before it was created.
234+
Negative caching (normal in DNS) means that the results of previous failed lookups are
235+
remembered and reused, even after the Pod is running, for at least a few seconds.
236+
237+
If you need to discover Pods promptly after they are created, you have a few options:
238+
239+
- Query the Kubernetes API directly (for example, using a watch) rather than relying on DNS lookups.
240+
- Decrease the time of caching in your Kubernetes DNS provider (typically this means editing the config map for CoreDNS, which currently caches for 30 seconds).
241+
242+
243+
As mentioned in the [limitations](#limitations) section, you are responsible for
244+
creating the [Headless Service](/docs/concepts/services-networking/service/#headless-services)
245+
responsible for the network identity of the pods.
246+
247+
-->
248+
取决于集群域内部 DNS 的配置,有可能无法查询一个刚刚启动的 Pod 上的 DNS 命名。这个情况会在其他集群域内部的客户端在主机 Pod 创建完成前
249+
发出查询请求。负缓存 (通常来说在 DNS 内) 意味着之前失败的查询结果在特定秒数内被记录和被重用,甚至直至 Pod 正常运行。
250+
251+
如果需要及时查询创建之后的 Pod ,有以下选项:
252+
253+
- 直接查询 Kubernetes API(比如,利用 watch 机制)而不是依赖于 DNS 查询
254+
- 减少 Kubernetes DNS 提供商的 缓存时效(通常这意味着修改 CoreDNS 的 config map,目前 config map 会缓存30秒信息)
255+
256+
正如 [限制](#limitations) 中提到的,创建 [无头服务](zh/docs/concepts/services-networking/service/#headless-services)
257+
需要对其 Pod 的网络标识负责。
258+
220259
<!--
221260
Here are some examples of choices for Cluster Domain, Service name,
222261
StatefulSet name, and how that affects the DNS names for the StatefulSet's Pods.
262+
263+
264+
Cluster Domain | Service (ns/name) | StatefulSet (ns/name) | StatefulSet Domain | Pod DNS | Pod Hostname |
265+
-------------- | ----------------- | ----------------- | -------------- | ------- | ------------ |
266+
cluster.local | default/nginx | default/web | nginx.default.svc.cluster.local | web-{0..N-1}.nginx.default.svc.cluster.local | web-{0..N-1} |
267+
cluster.local | foo/nginx | foo/web | nginx.foo.svc.cluster.local | web-{0..N-1}.nginx.foo.svc.cluster.local | web-{0..N-1} |
268+
kube.local | foo/nginx | foo/web | nginx.foo.svc.kube.local | web-{0..N-1}.nginx.foo.svc.kube.local | web-{0..N-1} |
269+
223270
-->
224271
下面给出一些选择集群域、服务名、StatefulSet 名、及其怎样影响 StatefulSet 的 Pod 上的 DNS 名称的示例:
225272

@@ -350,12 +397,14 @@ described [above](#deployment-and-scaling-guarantees).
350397
`Parallel` pod management tells the StatefulSet controller to launch or
351398
terminate all Pods in parallel, and to not wait for Pods to become Running
352399
and Ready or completely terminated prior to launching or terminating another
353-
Pod.
400+
Pod. This option only affects the behavior for scaling operations. Updates are not affected.
401+
354402
-->
355403
#### 并行 Pod 管理 {#parallel-pod-management}
356404

357405
`Parallel` Pod 管理让 StatefulSet 控制器并行的启动或终止所有的 Pod,
358406
启动或者终止其他 Pod 前,无需等待 Pod 进入 Running 和 ready 或者完全停止状态。
407+
这个选项只会影响伸缩操作的行为,更新则不会被影响。
359408

360409
<!--
361410
## Update Strategies

0 commit comments

Comments
 (0)