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
Create the following Service without the `ipFamily` field set. When this field is not set, the Service gets an IP from the first configured range via `--service-cluster-ip-range` flag on the kube-controller-manager.
154
+
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`.
154
155
-->
155
156
## 验证服务
156
157
157
-
在不设置 `ipFamily` 字段的情况下创建以下服务。
158
-
如果未设置此字段,则服务会通过 kube-controller-manager 上的
159
-
`--service-cluster-ip-range` 标志从第一个配置的范围中获取 IP。
158
+
创建以下未显式定义 `.spec.ipFamilyPolicy` 的 Service。
159
+
Kubernetes 将从首个配置的 `service-cluster-ip-range` 给 Service 分配集群 IP,
By viewing the YAML for the Service you can observe that the Service has the `ipFamily` field has set to reflect the address family of the first configured range set via `--service-cluster-ip-range` flag on kube-controller-manager.
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.
175
+
-->
176
+
该 Service 通过在 kube-controller-manager 的 `--service-cluster-ip-range`
Create the following Service with the `ipFamily` field set to `IPv6`.
206
+
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`.
Validate that the Service gets a cluster IP address from the IPv6 address block. You may then validate access to the service via the IP and port.
214
+
<!--
215
+
Use `kubectl` to view the YAML for the Service.
210
216
-->
211
-
验证服务是否是 IPv6 地址块获取集群 IP 地址。
212
-
然后,你可以通过 IP 和端口验证对服务的访问。
217
+
使用 `kubectl` 查看 Service 的 YAML 定义。
213
218
214
219
```shell
215
-
kubectl get svc -l app=MyApp
220
+
kubectl get svc my-service -o yaml
216
221
```
222
+
223
+
<!--
224
+
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.
225
+
-->
226
+
该 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.
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.
0 commit comments