Converting to IPv4/IPv6 dual-stack networking
As a cluster administrator, you can convert your IPv4 single-stack cluster to a dual-network cluster network that supports IPv4 and IPv6 address families. After converting to dual-stack, all newly created pods are dual-stack enabled.
A dual-stack network is supported on clusters provisioned on bare metal, IBM Power infrastructure, and single node OpenShift clusters. |
Converting to a dual-stack cluster network
As a cluster administrator, you can convert your single-stack cluster network to a dual-stack cluster network.
After converting to dual-stack networking only newly created pods are assigned IPv6 addresses. Any pods created before the conversion must be recreated to receive an IPv6 address. |
Prerequisites
You installed the OpenShift CLI (
oc
).You are logged in to the cluster with a user with
cluster-admin
privileges.Your cluster uses the OVN-Kubernetes cluster network provider.
The cluster nodes have IPv6 addresses.
You have configured an IPv6-enabled router based on your infrastructure.
Procedure
To specify IPv6 address blocks for the cluster and service networks, create a file containing the following YAML:
- op: add
path: /spec/clusterNetwork/-
value: (1)
cidr: fd01::/48
hostPrefix: 64
- op: add
path: /spec/serviceNetwork/-
value: fd02::/112 (2)
1 Specify an object with the cidr
andhostPrefix
fields. The host prefix must be64
or greater. The IPv6 CIDR prefix must be large enough to accommodate the specified host prefix.2 Specify an IPv6 CIDR with a prefix of 112
. Kubernetes uses only the lowest 16 bits. For a prefix of112
, IP addresses are assigned from112
to128
bits.To patch the cluster network configuration, enter the following command:
$ oc patch network.config.openshift.io cluster \
--type='json' --patch-file <file>.yaml
where:
file
Specifies the name of the file you created in the previous step.
Example output
network.config.openshift.io/cluster patched
Verification
Complete the following step to verify that the cluster network recognizes the IPv6 address blocks that you specified in the previous procedure.
Display the network configuration:
$ oc describe network
Example output
Status:
Cluster Network:
Cidr: 10.128.0.0/14
Host Prefix: 23
Cidr: fd01::/48
Host Prefix: 64
Cluster Network MTU: 1400
Network Type: OVNKubernetes
Service Network:
172.30.0.0/16
fd02::/112
Converting to a single-stack cluster network
As a cluster administrator, you can convert your dual-stack cluster network to a single-stack cluster network.
Prerequisites
You installed the OpenShift CLI (
oc
).You are logged in to the cluster with a user with
cluster-admin
privileges.Your cluster uses the OVN-Kubernetes cluster network provider.
The cluster nodes have IPv6 addresses.
You have enabled dual-stack networking.
Procedure
Edit the
Network.operator.openshift.io
custom resource (CR) by running the following command:$ oc edit networks.operator.openshift.io
Remove the IPv6 specific configuration that you have added to the
cidr
andhostPrefix
fields in the previous procedure.