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 only installer-provisioned bare metal infrastructure.

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.

Procedure

  1. To specify IPv6 address blocks for the cluster and service networks, create a file containing the following YAML:

    1. - op: add
    2. path: /spec/clusterNetwork/-
    3. value: (1)
    4. cidr: fd01::/48
    5. hostPrefix: 64
    6. - op: add
    7. path: /spec/serviceNetwork/-
    8. value: fd02::/112 (2)
    1Specify an object with the cidr and hostPrefix fields. The host prefix must be 64 or greater. The IPv6 CIDR prefix must be large enough to accommodate the specified host prefix.
    2Specify an IPv6 CIDR with a prefix of 112. Kubernetes uses only the lowest 16 bits. For a prefix of 112, IP addresses are assigned from 112 to 128 bits.
  2. To patch the cluster network configuration, enter the following command:

    1. $ oc patch network.config.openshift.io cluster \
    2. --type='json' --patch-file <file>.yaml

    where:

    file

    Specifies the name of the file you created in the previous step.

    Example output

    1. 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.

  1. Display the network configuration:

    1. $ oc describe network

    Example output

    1. Status:
    2. Cluster Network:
    3. Cidr: 10.128.0.0/14
    4. Host Prefix: 23
    5. Cidr: fd01::/48
    6. Host Prefix: 64
    7. Cluster Network MTU: 1400
    8. Network Type: OVNKubernetes
    9. Service Network:
    10. 172.30.0.0/16
    11. fd02::/112