You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
以避免留下孤立的 Service ClusterIP;只有在存在包含现有 IPAddress 的另一个子网或者没有属于此子网的
@@ -99,7 +99,9 @@ IPAddress 时,才会移除终结器。
99
99
<!--
100
100
## Extend the number of available IPs for Services
101
101
102
-
There are cases that users will need to increase the number addresses available to Services, previously, increasing the Service range was a disruptive operation that could also cause data loss. With this new feature users only need to add a new ServiceCIDR to increase the number of available addresses.
102
+
There are cases that users will need to increase the number addresses available to Services,
103
+
previously, increasing the Service range was a disruptive operation that could also cause data loss.
104
+
With this new feature users only need to add a new ServiceCIDR to increase the number of available addresses.
103
105
-->
104
106
## 扩展 Service 可用的 IP 数量 {#extend-the-number-of-available-ips-for-services}
105
107
@@ -110,7 +112,9 @@ There are cases that users will need to increase the number addresses available
110
112
<!--
111
113
### Adding a new ServiceCIDR
112
114
113
-
On a cluster with a 10.96.0.0/28 range for Services, there is only 2^(32-28) - 2 = 14 IP addresses available. The `kubernetes.default` Service is always created; for this example, that leaves you with only 13 possible Services.
115
+
On a cluster with a 10.96.0.0/28 range for Services, there is only 2^(32-28) - 2 = 14
116
+
IP addresses available. The `kubernetes.default` Service is always created; for this example,
Copy file name to clipboardExpand all lines: content/zh-cn/docs/tasks/network/validate-dual-stack.md
+56-26Lines changed: 56 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -22,21 +22,23 @@ This document shares how to validate IPv4/IPv6 dual-stack enabled Kubernetes clu
22
22
## {{% heading "prerequisites" %}}
23
23
24
24
<!--
25
-
* Provider support for dual-stack networking (Cloud provider or otherwise must be able to provide Kubernetes nodes with routable IPv4/IPv6 network interfaces)
26
-
* A [network plugin](/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/) that supports dual-stack networking.
25
+
* Provider support for dual-stack networking (Cloud provider or otherwise must be able to
26
+
provide Kubernetes nodes with routable IPv4/IPv6 network interfaces)
27
+
* A [network plugin](/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/)
While you can validate with an earlier version, the feature is only GA and officially supported since v1.23.
38
41
-->
39
-
{{< note >}}
40
42
虽然你可以使用较早的版本进行验证,但该功能是从 v1.23 版本进入 GA 状态并正式支持的。
41
43
{{< /note >}}
42
44
@@ -47,11 +49,14 @@ While you can validate with an earlier version, the feature is only GA and offic
47
49
48
50
### Validate node addressing
49
51
50
-
Each dual-stack Node should have a single IPv4 block and a single IPv6 block allocated. Validate that IPv4/IPv6 Pod address ranges are configured by running the following command. Replace the sample node name with a valid dual-stack Node from your cluster. In this example, the Node's name is `k8s-linuxpool1-34450317-0`:
52
+
Each dual-stack Node should have a single IPv4 block and a single IPv6 block allocated.
53
+
Validate that IPv4/IPv6 Pod address ranges are configured by running the following command.
54
+
Replace the sample node name with a valid dual-stack Node from your cluster. In this example,
55
+
the Node's name is `k8s-linuxpool1-34450317-0`:
51
56
-->
52
-
## 验证寻址
57
+
## 验证寻址 {#validate-addressing}
53
58
54
-
### 验证节点寻址
59
+
### 验证节点寻址 {#validate-node-addressing}
55
60
56
61
每个双协议栈节点应分配一个 IPv4 块和一个 IPv6 块。
57
62
通过运行以下命令来验证是否配置了 IPv4/IPv6 Pod 地址范围。
@@ -73,7 +78,9 @@ There should be one IPv4 block and one IPv6 block allocated.
73
78
应该分配一个 IPv4 块和一个 IPv6 块。
74
79
75
80
<!--
76
-
Validate that the node has an IPv4 and IPv6 interface detected. Replace node name with a valid node from the cluster. In this example the node name is `k8s-linuxpool1-34450317-0`:
81
+
Validate that the node has an IPv4 and IPv6 interface detected.
82
+
Replace node name with a valid node from the cluster.
83
+
In this example the node name is `k8s-linuxpool1-34450317-0`:
77
84
-->
78
85
验证节点是否检测到 IPv4 和 IPv6 接口。用集群中的有效节点替换节点名称。
79
86
在此示例中,节点名称为 `k8s-linuxpool1-34450317-0`:
@@ -91,9 +98,10 @@ InternalIP: 2001:db8:10::5
91
98
<!--
92
99
### Validate Pod addressing
93
100
94
-
Validate that a Pod has an IPv4 and IPv6 address assigned. Replace the Pod name with a valid Pod in your cluster. In this example the Pod name is `pod01`.
101
+
Validate that a Pod has an IPv4 and IPv6 address assigned. Replace the Pod name with
102
+
a valid Pod in your cluster. In this example the Pod name is `pod01`:
You can also validate Pod IPs using the Downward API via the `status.podIPs` fieldPath. The following snippet demonstrates how you can expose the Pod IPs via an environment variable called `MY_POD_IPS` within a container.
119
+
You can also validate Pod IPs using the Downward API via the `status.podIPs` fieldPath.
120
+
The following snippet demonstrates how you can expose the Pod IPs via an environment variable
121
+
called `MY_POD_IPS` within a container.
112
122
-->
113
123
你也可以通过 `status.podIPs` 使用 Downward API 验证 Pod IP。
114
124
以下代码段演示了如何通过容器内称为 `MY_POD_IPS` 的环境变量公开 Pod 的 IP 地址。
@@ -122,7 +132,9 @@ env:
122
132
```
123
133
124
134
<!--
125
-
The following command prints the value of the `MY_POD_IPS` environment variable from within a container. The value is a comma separated list that corresponds to the Pod's IPv4 and IPv6 addresses.
135
+
The following command prints the value of the `MY_POD_IPS` environment variable from
136
+
within a container. The value is a comma separated list that corresponds to the
The Pod's IP addresses will also be written to `/etc/hosts` within a container. The following command executes a cat on `/etc/hosts` on a dual stack Pod. From the output you can verify both the IPv4 and IPv6 IP address for the Pod.
151
+
The Pod's IP addresses will also be written to `/etc/hosts` within a container.
152
+
The following command executes a cat on `/etc/hosts` on a dual stack Pod.
153
+
From the output you can verify both the IPv4 and IPv6 IP address for the Pod.
140
154
-->
141
155
Pod 的 IP 地址也将被写入容器内的 `/etc/hosts` 文件中。
142
156
在双栈 Pod 上执行 cat `/etc/hosts` 命令操作。
@@ -161,9 +175,11 @@ fe00::2 ip6-allrouters
161
175
<!--
162
176
## Validate Services
163
177
164
-
Create the following Service that does not explicitly define `.spec.ipFamilyPolicy`. Kubernetes will assign a cluster IP for the Service from the first configured `service-cluster-ip-range` and set the `.spec.ipFamilyPolicy` to `SingleStack`.
178
+
Create the following Service that does not explicitly define `.spec.ipFamilyPolicy`.
179
+
Kubernetes will assign a cluster IP for the Service from the first configured
180
+
`service-cluster-ip-range` and set the `.spec.ipFamilyPolicy` to `SingleStack`.
165
181
-->
166
-
## 验证服务
182
+
## 验证服务 {#validate-services}
167
183
168
184
创建以下未显式定义 `.spec.ipFamilyPolicy` 的 Service。
169
185
Kubernetes 将从首个配置的 `service-cluster-ip-range` 给 Service 分配集群 IP,
@@ -181,9 +197,11 @@ kubectl get svc my-service -o yaml
181
197
```
182
198
183
199
<!--
184
-
The Service has `.spec.ipFamilyPolicy` set to `SingleStack` and `.spec.clusterIP` set to an IPv4 address from the first configured range set via `--service-cluster-ip-range` flag on kube-controller-manager.
200
+
The Service has `.spec.ipFamilyPolicy` set to `SingleStack` and `.spec.clusterIP` set
201
+
to an IPv4 address from the first configured range set via `--service-cluster-ip-range`
202
+
flag on kube-controller-manager.
185
203
-->
186
-
该 Service 通过在 kube-controller-manager 的 `--service-cluster-ip-range`
204
+
该 Service 通过在 kube-controller-manager 的 `--service-cluster-ip-range`
Create the following Service that explicitly defines `IPv6` as the first array element in `.spec.ipFamilies`. Kubernetes will assign a cluster IP for the Service from the IPv6 range configured `service-cluster-ip-range` and set the `.spec.ipFamilyPolicy` to `SingleStack`.
234
+
Create the following Service that explicitly defines `IPv6` as the first array element in
235
+
`.spec.ipFamilies`. Kubernetes will assign a cluster IP for the Service from the IPv6 range
236
+
configured `service-cluster-ip-range` and set the `.spec.ipFamilyPolicy` to `SingleStack`.
Kubernetes 将 `service-cluster-ip-range` 配置的 IPv6 地址范围给 Service 分配集群 IP,
@@ -231,9 +251,10 @@ kubectl get svc my-service -o yaml
231
251
```
232
252
233
253
<!--
234
-
The Service has `.spec.ipFamilyPolicy` set to `SingleStack` and `.spec.clusterIP` set to an IPv6 address from the IPv6 range set via `--service-cluster-ip-range` flag on kube-controller-manager.
254
+
The Service has `.spec.ipFamilyPolicy` set to `SingleStack` and `.spec.clusterIP` set to
255
+
an IPv6 address from the IPv6 range set via `--service-cluster-ip-range` flag on kube-controller-manager.
235
256
-->
236
-
该 Service 通过在 kube-controller-manager 的 `--service-cluster-ip-range`
257
+
该 Service 通过在 kube-controller-manager 的 `--service-cluster-ip-range`
Create the following Service that explicitly defines `PreferDualStack` in `.spec.ipFamilyPolicy`. Kubernetes will assign both IPv4 and IPv6 addresses (as this cluster has dual-stack enabled) and select the `.spec.ClusterIP` from the list of `.spec.ClusterIPs` based on the address family of the first element in the `.spec.ipFamilies` array.
288
+
Create the following Service that explicitly defines `PreferDualStack` in `.spec.ipFamilyPolicy`.
289
+
Kubernetes will assign both IPv4 and IPv6 addresses (as this cluster has dual-stack enabled) and
290
+
select the `.spec.ClusterIP` from the list of `.spec.ClusterIPs` based on the address family of
291
+
the first element in the `.spec.ipFamilies` array.
Validate that the Service gets cluster IPs from the IPv4 and IPv6 address blocks using `kubectl describe`. You may then validate access to the service via the IPs and ports.
317
+
Validate that the Service gets cluster IPs from the IPv4 and IPv6 address blocks using
318
+
`kubectl describe`. You may then validate access to the service via the IPs and ports.
If the cloud provider supports the provisioning of IPv6 enabled external load balancers, create the following Service with `PreferDualStack` in `.spec.ipFamilyPolicy`, `IPv6` as the first element of the `.spec.ipFamilies` array and the `type` field set to `LoadBalancer`.
348
+
If the cloud provider supports the provisioning of IPv6 enabled external load balancers,
349
+
create the following Service with `PreferDualStack` in `.spec.ipFamilyPolicy`, `IPv6` as
350
+
the first element of the `.spec.ipFamilies` array and the `type` field set to `LoadBalancer`.
@@ -338,12 +367,13 @@ kubectl get svc -l app.kubernetes.io/name=MyApp
338
367
```
339
368
340
369
<!--
341
-
Validate that the Service receives a `CLUSTER-IP` address from the IPv6 address block along with an `EXTERNAL-IP`. You may then validate access to the service via the IP and port.
370
+
Validate that the Service receives a `CLUSTER-IP` address from the IPv6 address block
371
+
along with an `EXTERNAL-IP`. You may then validate access to the service via the IP and port.
0 commit comments