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
Copy file name to clipboardExpand all lines: content/en/docs/tasks/network/extend-service-ip-ranges.md
+23-10Lines changed: 23 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -24,14 +24,15 @@ This document shares how to extend the existing Service IP range assigned to a c
24
24
## API
25
25
26
26
Kubernetes clusters with kube-apiservers that have enabled the `MultiCIDRServiceAllocator`
27
-
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) and have the`networking.k8s.io/v1beta1`
28
-
API group active,
29
-
will create a ServiceCIDR object that takes the well-known name `kubernetes`, and that specifies an IP address range
27
+
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) and have the
28
+
`networking.k8s.io/v1beta1`API group active, will create a ServiceCIDR object that takes
29
+
the well-known name `kubernetes`, and that specifies an IP address range
30
30
based on the value of the `--service-cluster-ip-range` command line argument to kube-apiserver.
31
31
32
32
```sh
33
33
kubectl get servicecidr
34
34
```
35
+
35
36
```
36
37
NAME CIDRS AGE
37
38
kubernetes 10.96.0.0/28 17d
@@ -44,6 +45,7 @@ cluster IP address.
44
45
```sh
45
46
kubectl get service kubernetes
46
47
```
48
+
47
49
```
48
50
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
49
51
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 17d
@@ -54,26 +56,32 @@ The default Service, in this case, uses the ClusterIP 10.96.0.1, that has the co
54
56
```sh
55
57
kubectl get ipaddress 10.96.0.1
56
58
```
59
+
57
60
```
58
61
NAME PARENTREF
59
62
10.96.0.1 services/default/kubernetes
60
63
```
61
64
62
-
The ServiceCIDRs are protected with {{<glossary_tooltip text="finalizers" term_id="finalizer">}}, to avoid leaving Service ClusterIPs orphans;
63
-
the finalizer is only removed if there is another subnet that contains the existing IPAddresses or
64
-
there are no IPAddresses belonging to the subnet.
65
+
The ServiceCIDRs are protected with {{<glossary_tooltip text="finalizers" term_id="finalizer">}},
66
+
to avoid leaving Service ClusterIPs orphans; the finalizer is only removed if there is another subnet
67
+
that contains the existing IPAddresses or there are no IPAddresses belonging to the subnet.
65
68
66
69
## Extend the number of available IPs for Services
67
70
68
-
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.
71
+
There are cases that users will need to increase the number addresses available to Services,
72
+
previously, increasing the Service range was a disruptive operation that could also cause data loss.
73
+
With this new feature users only need to add a new ServiceCIDR to increase the number of available addresses.
69
74
70
75
### Adding a new ServiceCIDR
71
76
72
-
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.
77
+
On a cluster with a 10.96.0.0/28 range for Services, there is only 2^(32-28) - 2 = 14
78
+
IP addresses available. The `kubernetes.default` Service is always created; for this example,
Copy file name to clipboardExpand all lines: content/en/docs/tasks/network/validate-dual-stack.md
+54-23Lines changed: 54 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -11,12 +11,12 @@ content_type: task
11
11
<!-- overview -->
12
12
This document shares how to validate IPv4/IPv6 dual-stack enabled Kubernetes clusters.
13
13
14
-
15
14
## {{% heading "prerequisites" %}}
16
15
17
-
18
-
* Provider support for dual-stack networking (Cloud provider or otherwise must be able to provide Kubernetes nodes with routable IPv4/IPv6 network interfaces)
19
-
* A [network plugin](/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/) that supports dual-stack networking.
16
+
* Provider support for dual-stack networking (Cloud provider or otherwise must be able to
17
+
provide Kubernetes nodes with routable IPv4/IPv6 network interfaces)
18
+
* A [network plugin](/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/)
@@ -25,29 +25,36 @@ This document shares how to validate IPv4/IPv6 dual-stack enabled Kubernetes clu
25
25
While you can validate with an earlier version, the feature is only GA and officially supported since v1.23.
26
26
{{< /note >}}
27
27
28
-
29
28
<!-- steps -->
30
29
31
30
## Validate addressing
32
31
33
32
### Validate node addressing
34
33
35
-
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`:
34
+
Each dual-stack Node should have a single IPv4 block and a single IPv6 block allocated.
35
+
Validate that IPv4/IPv6 Pod address ranges are configured by running the following command.
36
+
Replace the sample node name with a valid dual-stack Node from your cluster. In this example,
37
+
the Node's name is `k8s-linuxpool1-34450317-0`:
36
38
37
39
```shell
38
40
kubectl get nodes k8s-linuxpool1-34450317-0 -o go-template --template='{{range .spec.podCIDRs}}{{printf "%s\n" .}}{{end}}'
39
41
```
42
+
40
43
```
41
44
10.244.1.0/24
42
45
2001:db8::/64
43
46
```
47
+
44
48
There should be one IPv4 block and one IPv6 block allocated.
45
49
46
-
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`:
50
+
Validate that the node has an IPv4 and IPv6 interface detected.
51
+
Replace node name with a valid node from the cluster.
52
+
In this example the node name is `k8s-linuxpool1-34450317-0`:
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`:
66
+
Validate that a Pod has an IPv4 and IPv6 address assigned. Replace the Pod name with
67
+
a valid Pod in your cluster. In this example the Pod name is `pod01`:
60
68
61
69
```shell
62
70
kubectl get pods pod01 -o go-template --template='{{range .status.podIPs}}{{printf "%s\n" .ip}}{{end}}'
63
71
```
72
+
64
73
```
65
74
10.244.1.4
66
75
2001:db8::4
67
76
```
68
77
69
-
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.
78
+
You can also validate Pod IPs using the Downward API via the `status.podIPs` fieldPath.
79
+
The following snippet demonstrates how you can expose the Pod IPs via an environment variable
80
+
called `MY_POD_IPS` within a container.
70
81
71
-
```
82
+
```yaml
72
83
env:
73
84
- name: MY_POD_IPS
74
85
valueFrom:
75
86
fieldRef:
76
87
fieldPath: status.podIPs
77
88
```
78
89
79
-
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.
90
+
The following command prints the value of the `MY_POD_IPS` environment variable from
91
+
within a container. The value is a comma separated list that corresponds to the
92
+
Pod's IPv4 and IPv6 addresses.
80
93
81
94
```shell
82
95
kubectl exec -it pod01 -- set | grep MY_POD_IPS
83
96
```
97
+
84
98
```
85
99
MY_POD_IPS=10.244.1.4,2001:db8::4
86
100
```
87
101
88
-
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.
102
+
The Pod's IP addresses will also be written to `/etc/hosts` within a container.
103
+
The following command executes a cat on `/etc/hosts` on a dual stack Pod.
104
+
From the output you can verify both the IPv4 and IPv6 IP address for the Pod.
89
105
90
106
```shell
91
107
kubectl exec -it pod01 -- cat /etc/hosts
92
108
```
109
+
93
110
```
94
111
# Kubernetes-managed hosts file.
95
112
127.0.0.1 localhost
@@ -104,7 +121,9 @@ fe00::2 ip6-allrouters
104
121
105
122
## Validate Services
106
123
107
-
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`.
124
+
Create the following Service that does not explicitly define `.spec.ipFamilyPolicy`.
125
+
Kubernetes will assign a cluster IP for the Service from the first configured
126
+
`service-cluster-ip-range` and set the `.spec.ipFamilyPolicy` to `SingleStack`.
@@ -114,7 +133,9 @@ Use `kubectl` to view the YAML for the Service.
114
133
kubectl get svc my-service -o yaml
115
134
```
116
135
117
-
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.
136
+
The Service has `.spec.ipFamilyPolicy` set to `SingleStack` and `.spec.clusterIP` set
137
+
to an IPv4 address from the first configured range set via `--service-cluster-ip-range`
138
+
flag on kube-controller-manager.
118
139
119
140
```yaml
120
141
apiVersion: v1
@@ -141,7 +162,9 @@ status:
141
162
loadBalancer: {}
142
163
```
143
164
144
-
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`.
165
+
Create the following Service that explicitly defines `IPv6` as the first array element in
166
+
`.spec.ipFamilies`. Kubernetes will assign a cluster IP for the Service from the IPv6 range
167
+
configured `service-cluster-ip-range` and set the `.spec.ipFamilyPolicy` to `SingleStack`.
@@ -151,7 +174,8 @@ Use `kubectl` to view the YAML for the Service.
151
174
kubectl get svc my-service -o yaml
152
175
```
153
176
154
-
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.
177
+
The Service has `.spec.ipFamilyPolicy` set to `SingleStack` and `.spec.clusterIP` set to
178
+
an IPv6 address from the IPv6 range set via `--service-cluster-ip-range` flag on kube-controller-manager.
155
179
156
180
```yaml
157
181
apiVersion: v1
@@ -179,7 +203,10 @@ status:
179
203
loadBalancer: {}
180
204
```
181
205
182
-
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.
206
+
Create the following Service that explicitly defines `PreferDualStack` in `.spec.ipFamilyPolicy`.
207
+
Kubernetes will assign both IPv4 and IPv6 addresses (as this cluster has dual-stack enabled) and
208
+
select the `.spec.ClusterIP` from the list of `.spec.ClusterIPs` based on the address family of
209
+
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.
226
+
Validate that the Service gets cluster IPs from the IPv4 and IPv6 address blocks using
227
+
`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`.
253
+
If the cloud provider supports the provisioning of IPv6 enabled external load balancers,
254
+
create the following Service with `PreferDualStack` in `.spec.ipFamilyPolicy`, `IPv6` as
255
+
the first element of the `.spec.ipFamilies` array and the `type` field set to `LoadBalancer`.
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.
265
+
Validate that the Service receives a `CLUSTER-IP` address from the IPv6 address block
266
+
along with an `EXTERNAL-IP`. You may then validate access to the service via the IP and port.
0 commit comments