@@ -179,16 +179,16 @@ Service 的地址族默认为第一个服务集群 IP 范围的地址族(通
179
179
using the first configured service cluster IP range.
180
180
* `PreferDualStack`:Allocates both IPv4 and IPv6 cluster IPs for the Service when dual-stack is enabled. If dual-stack is not enabled or supported, it falls back to single-stack behavior.
181
181
* `RequireDualStack`: Allocates Service `.spec.clusterIPs` from both IPv4 and IPv6 address ranges when dual-stack is enabled. If dual-stack is not enabled or supported, the Service API object creation fails.
182
- * Selects the `.spec.ClusterIP ` from the list of `.spec.ClusterIPs ` based on the address family
182
+ * Selects the `.spec.clusterIP ` from the list of `.spec.clusterIPs ` based on the address family
183
183
of the first element in the `.spec.ipFamilies` array.
184
184
-->
185
185
* ` SingleStack ` :单栈 Service。控制面使用第一个配置的服务集群 IP 范围为 Service 分配集群 IP。
186
186
* ` PreferDualStack ` :启用双栈时,为 Service 同时分配 IPv4 和 IPv6 集群 IP 地址。
187
187
如果双栈未被启用或不被支持,则会返回到单栈行为。
188
- * ` RequireDualStack ` :启用双栈时,同时从 IPv4 和 IPv6 的地址范围中分配 Service 的 ` .spec.ClusterIPs ` 。
188
+ * ` RequireDualStack ` :启用双栈时,同时从 IPv4 和 IPv6 的地址范围中分配 Service 的 ` .spec.clusterIPs ` 。
189
189
如果双栈未被启用或不被支持,则 Service API 对象创建失败。
190
- * 从基于在 ` .spec.ipFamilies ` 数组中第一个元素的地址族的 ` .spec.ClusterIPs `
191
- 列表中选择 ` .spec.ClusterIP `
190
+ * 从基于在 ` .spec.ipFamilies ` 数组中第一个元素的地址族的 ` .spec.clusterIPs `
191
+ 列表中选择 ` .spec.clusterIP `
192
192
193
193
<!--
194
194
If you would like to define which IP family to use for single stack or define the order of IP
@@ -224,9 +224,9 @@ You can set `.spec.ipFamilies` to any of the following array values:
224
224
- ` ["IPv6","IPv4"] ` (双栈)
225
225
226
226
<!--
227
- The first family you list is used for the legacy `.spec.ClusterIP ` field.
227
+ The first family you list is used for the legacy `.spec.clusterIP ` field.
228
228
-->
229
- 你所列出的第一个地址族用于原来的 ` .spec.ClusterIP ` 字段。
229
+ 你所列出的第一个地址族用于原来的 ` .spec.clusterIP ` 字段。
230
230
231
231
<!--
232
232
### Dual-stack Service configuration scenarios
@@ -262,26 +262,26 @@ These examples demonstrate the behavior of various dual-stack Service configurat
262
262
1. This Service specification explicitly defines `PreferDualStack` in `.spec.ipFamilyPolicy`. When
263
263
you create this Service on a dual-stack cluster, Kubernetes assigns both IPv4 and IPv6
264
264
addresses for the service. The control plane updates the `.spec` for the Service to record the IP
265
- address assignments. The field `.spec.ClusterIPs ` is the primary field, and contains both assigned
266
- IP addresses; `.spec.ClusterIP ` is a secondary field with its value calculated from
267
- `.spec.ClusterIPs `.
265
+ address assignments. The field `.spec.clusterIPs ` is the primary field, and contains both assigned
266
+ IP addresses; `.spec.clusterIP ` is a secondary field with its value calculated from
267
+ `.spec.clusterIPs `.
268
268
269
- * For the `.spec.ClusterIP ` field, the control plane records the IP address that is from the
269
+ * For the `.spec.clusterIP ` field, the control plane records the IP address that is from the
270
270
same address family as the first service cluster IP range.
271
- * On a single-stack cluster, the `.spec.ClusterIPs ` and `.spec.ClusterIP ` fields both only list
271
+ * On a single-stack cluster, the `.spec.clusterIPs ` and `.spec.clusterIP ` fields both only list
272
272
one address.
273
273
* On a cluster with dual-stack enabled, specifying `RequireDualStack` in `.spec.ipFamilyPolicy`
274
274
behaves the same as `PreferDualStack`.
275
275
-->
276
276
2 . 此 Service 规约显式地将 ` .spec.ipFamilyPolicy ` 设置为 ` PreferDualStack ` 。
277
277
当你在双栈集群上创建此 Service 时,Kubernetes 会为此 Service 分配 IPv4 和 IPv6 地址。
278
278
控制平面更新 Service 的 ` .spec ` 以记录 IP 地址分配。
279
- 字段 ` .spec.ClusterIPs ` 是主要字段,包含两个分配的 IP 地址;` .spec.ClusterIP ` 是次要字段,
280
- 其取值从 ` .spec.ClusterIPs ` 计算而来。
279
+ 字段 ` .spec.clusterIPs ` 是主要字段,包含两个分配的 IP 地址;` .spec.clusterIP ` 是次要字段,
280
+ 其取值从 ` .spec.clusterIPs ` 计算而来。
281
281
282
- * 对于 ` .spec.ClusterIP ` 字段,控制面记录来自第一个服务集群 IP
282
+ * 对于 ` .spec.clusterIP ` 字段,控制面记录来自第一个服务集群 IP
283
283
范围对应的地址族的 IP 地址。
284
- * 对于单协议栈的集群,` .spec.ClusterIPs ` 和 ` .spec.ClusterIP ` 字段都
284
+ * 对于单协议栈的集群,` .spec.clusterIPs ` 和 ` .spec.clusterIP ` 字段都
285
285
仅仅列出一个地址。
286
286
* 对于启用了双协议栈的集群,将 ` .spec.ipFamilyPolicy ` 设置为
287
287
` RequireDualStack ` 时,其行为与 ` PreferDualStack ` 相同。
@@ -291,13 +291,13 @@ These examples demonstrate the behavior of various dual-stack Service configurat
291
291
<!--
292
292
1. This Service specification explicitly defines `IPv6` and `IPv4` in `.spec.ipFamilies` as well
293
293
as defining `PreferDualStack` in `.spec.ipFamilyPolicy`. When Kubernetes assigns an IPv6 and
294
- IPv4 address in `.spec.ClusterIPs `, `.spec.ClusterIP ` is set to the IPv6 address because that is
295
- the first element in the `.spec.ClusterIPs ` array, overriding the default.
294
+ IPv4 address in `.spec.clusterIPs `, `.spec.clusterIP ` is set to the IPv6 address because that is
295
+ the first element in the `.spec.clusterIPs ` array, overriding the default.
296
296
-->
297
297
3 . 下面的 Service 规约显式地在 ` .spec.ipFamilies ` 中指定 ` IPv6 ` 和 ` IPv4 ` ,并将
298
298
` .spec.ipFamilyPolicy ` 设定为 ` PreferDualStack ` 。
299
- 当 Kubernetes 为 ` .spec.ClusterIPs ` 分配一个 IPv6 和一个 IPv4 地址时,
300
- ` .spec.ClusterIP ` 被设置成 IPv6 地址,因为它是 ` .spec.ClusterIPs ` 数组中的第一个元素,
299
+ 当 Kubernetes 为 ` .spec.clusterIPs ` 分配一个 IPv6 和一个 IPv4 地址时,
300
+ ` .spec.clusterIP ` 被设置成 IPv6 地址,因为它是 ` .spec.clusterIPs ` 数组中的第一个元素,
301
301
覆盖其默认值。
302
302
303
303
{{% code_sample file="service/networking/dual-stack-preferred-ipfamilies-svc.yaml" %}}
@@ -319,7 +319,7 @@ dual-stack.)
319
319
1. When dual-stack is enabled on a cluster, existing Services (whether `IPv4` or `IPv6`) are
320
320
configured by the control plane to set `.spec.ipFamilyPolicy` to `SingleStack` and set
321
321
`.spec.ipFamilies` to the address family of the existing Service. The existing Service cluster IP
322
- will be stored in `.spec.ClusterIPs `.
322
+ will be stored in `.spec.clusterIPs `.
323
323
-->
324
324
1 . 在集群上启用双栈时,控制面会将现有 Service(无论是 ` IPv4 ` 还是 ` IPv6 ` )配置
325
325
` .spec.ipFamilyPolicy ` 为 ` SingleStack ` 并设置 ` .spec.ipFamilies `
@@ -366,14 +366,14 @@ dual-stack.)
366
366
[headless Services](/docs/concepts/services-networking/service/#headless-services) with selectors are
367
367
configured by the control plane to set ` .spec.ipFamilyPolicy` to `SingleStack` and set
368
368
` .spec.ipFamilies` to the address family of the first service cluster IP range (configured via the
369
- ` --service-cluster-ip-range` flag to the kube-apiserver) even though `.spec.ClusterIP ` is set to
369
+ ` --service-cluster-ip-range` flag to the kube-apiserver) even though `.spec.clusterIP ` is set to
370
370
` None` .
371
371
-->
372
372
2. 在集群上启用双栈时,带有选择算符的现有
373
373
[无头服务](/zh-cn/docs/concepts/services-networking/service/#headless-services)
374
374
由控制面设置 `.spec.ipFamilyPolicy` 为 `SingleStack`
375
375
并设置 `.spec.ipFamilies` 为第一个服务集群 IP 范围的地址族(通过配置 kube-apiserver 的
376
- ` --service-cluster-ip-range` 参数),即使 `.spec.ClusterIP ` 的设置值为 `None` 也如此。
376
+ ` --service-cluster-ip-range` 参数),即使 `.spec.clusterIP ` 的设置值为 `None` 也如此。
377
377
378
378
{{% code_sample file="service/networking/dual-stack-default-svc.yaml" %}}
379
379
@@ -455,15 +455,15 @@ Service 可以从单栈更改为双栈,也可以从双栈更改为单栈。
455
455
<!--
456
456
1. To change a Service from dual-stack to single-stack, change `.spec.ipFamilyPolicy` from
457
457
` PreferDualStack` or `RequireDualStack` to `SingleStack`. When you change this Service from
458
- dual-stack to single-stack, Kubernetes retains only the first element in the `.spec.ClusterIPs `
459
- array, and sets `.spec.ClusterIP ` to that IP address and sets `.spec.ipFamilies` to the address
460
- family of `.spec.ClusterIPs `.
458
+ dual-stack to single-stack, Kubernetes retains only the first element in the `.spec.clusterIPs `
459
+ array, and sets `.spec.clusterIP ` to that IP address and sets `.spec.ipFamilies` to the address
460
+ family of `.spec.clusterIPs `.
461
461
-->
462
462
2. 要将 Service 从双栈更改为单栈,请将 `.spec.ipFamilyPolicy` 从 `PreferDualStack` 或
463
463
` RequireDualStack` 改为 `SingleStack`。
464
- 当你将此 Service 从双栈更改为单栈时,Kubernetes 只保留 `.spec.ClusterIPs `
465
- 数组中的第一个元素,并设置 `.spec.ClusterIP ` 为那个 IP 地址,
466
- 并设置 `.spec.ipFamilies` 为 `.spec.ClusterIPs ` 地址族。
464
+ 当你将此 Service 从双栈更改为单栈时,Kubernetes 只保留 `.spec.clusterIPs `
465
+ 数组中的第一个元素,并设置 `.spec.clusterIP ` 为那个 IP 地址,
466
+ 并设置 `.spec.ipFamilies` 为 `.spec.clusterIPs ` 地址族。
467
467
468
468
<!--
469
469
# ## Headless Services without selector
0 commit comments