$ oc get network.operator.openshift.io \
-o jsonpath="{.items[0].spec.clusterNetwork}"
As a cluster administrator, you can expand the cluster network range after cluster installation. You might want to expand the cluster network range if you need more IP addresses for additional nodes.
For example, if you deployed a cluster and specified 10.128.0.0/19
as the cluster network range and a host prefix of 23
, you are limited to 16 nodes. You can expand that to 510 nodes by changing the CIDR mask on a cluster to /14
.
When expanding the cluster network address range, your cluster must use the OVN-Kubernetes network plugin. Other network plugins are not supported.
The following limitations apply when modifying the cluster network IP address range:
The CIDR mask size specified must always be smaller than the currently configured CIDR mask size, because you can only increase IP space by adding more nodes to an installed cluster
The host prefix cannot be modified
Pods that are configured with an overridden default gateway must be recreated after the cluster network expands
You can expand the IP address range for the cluster network. Because this change requires rolling out a new Operator configuration across the cluster, it can take up to 30 minutes to take effect.
Install the OpenShift CLI (oc
).
Log in to the cluster with a user with cluster-admin
privileges.
Ensure that the cluster uses the OVN-Kubernetes network plugin.
To obtain the cluster network range and host prefix for your cluster, enter the following command:
$ oc get network.operator.openshift.io \
-o jsonpath="{.items[0].spec.clusterNetwork}"
[{"cidr":"10.217.0.0/22","hostPrefix":23}]
To expand the cluster network IP address range, enter the following command. Use the CIDR IP address range and host prefix returned from the output of the previous command.
$ oc patch Network.config.openshift.io cluster --type='merge' --patch \
'{
"spec":{
"clusterNetwork": [ {"cidr":"<network>/<cidr>","hostPrefix":<prefix>} ],
"networkType": "OVNKubernetes"
}
}'
where:
<network>
Specifies the network part of the cidr
field that you obtained from the previous step. You cannot change this value.
<cidr>
Specifies the network prefix length. For example, 14
. Change this value to a smaller number than the value from the output in the previous step to expand the cluster network range.
<prefix>
Specifies the current host prefix for your cluster. This value must be the same value for the hostPrefix
field that you obtained from the previous step.
$ oc patch Network.config.openshift.io cluster --type='merge' --patch \
'{
"spec":{
"clusterNetwork": [ {"cidr":"10.217.0.0/14","hostPrefix": 23} ],
"networkType": "OVNKubernetes"
}
}'
network.config.openshift.io/cluster patched
To confirm that the configuration is active, enter the following command. It can take up to 30 minutes for this change to take effect.
$ oc get network.operator.openshift.io \
-o jsonpath="{.items[0].spec.clusterNetwork}"
[{"cidr":"10.217.0.0/14","hostPrefix":23}]