Contents

OpenShift Cluster Network CIDR Planning Cheatsheet

Reference tables for planning clusterNetwork sizing in OpenShift. The two key parameters are:

  • clusterNetwork.cidr — the overall pod IP space allocated across the cluster
  • clusterNetwork.hostPrefix — the subnet prefix length carved out per node from the cluster CIDR

How it works

Each node receives a dedicated subnet of size /hostPrefix from the clusterNetwork.cidr pool. The formulas are:

ValueFormula
Max nodes2^(hostPrefix − clusterPrefix)
Pod IPs per node2^(32 − hostPrefix) − 2
Total pod capacityMax nodes × Pod IPs per node
Note
hostPrefix must always be greater than the cluster CIDR prefix (a larger number = smaller subnet). Values below /25 per node are unusual in production — Kubernetes itself consumes several IPs per node (kube-proxy, host-network pods, etc.).

Default OpenShift configuration

networking:
  clusterNetwork:
    - cidr: 10.128.0.0/14
      hostPrefix: 23
  serviceNetwork:
    - 172.30.0.0/16
  networkType: OVNKubernetes

This gives: 512 max nodes × 510 pods/node = ~261,120 total pod slots.


Combination tables

Cluster CIDR /14 (default — 262,144 total IPs)

hostPrefixMax nodesPod IPs/nodeTotal pod slotsTypical use case
/23512510261,120OCP default — large clusters
/241,024254260,096Many nodes, moderate pod density
/252,048126258,048Very many nodes, low pod density
/264,09662254,000Edge / IoT fleet, minimal pods/node

Cluster CIDR /16 (65,536 total IPs)

hostPrefixMax nodesPod IPs/nodeTotal pod slotsTypical use case
/2312851065,280Medium cluster, high pod density
/2425625465,024Medium cluster, balanced
/2551212664,512Many small nodes
/261,0246263,488Large node count, minimal pods

Cluster CIDR /18 (16,384 total IPs)

hostPrefixMax nodesPod IPs/nodeTotal pod slotsTypical use case
/233251016,320Small cluster, high pod density
/246425416,256Small cluster, balanced
/2512812616,128Compact cluster, many nodes
/262566215,872Edge cluster, many small nodes

Cluster CIDR /20 (4,096 total IPs)

hostPrefixMax nodesPod IPs/nodeTotal pod slotsTypical use case
/2385104,080Minimal cluster, dense pods
/24162544,064Dev / lab cluster
/25321264,032SNO + workers, low density
/2664623,968Edge micro-cluster

Cluster CIDR /22 (1,024 total IPs)

hostPrefixMax nodesPod IPs/nodeTotal pod slotsTypical use case
/2442541,016SNO or 3-node compact
/2581261,008Compact + a few workers
/261662992Very small lab

Constraints and rules

RuleDetail
hostPrefix > clusterPrefixA node subnet must fit inside the cluster CIDR
hostPrefix ≤ 30/31 and /32 leave no usable IPs
hostPrefix ≥ 23 recommendedFewer than 126 pods/node causes scheduling pressure
clusterNetworkserviceNetworkThe two ranges must not overlap
clusterNetwork ≠ machine/node CIDRsMust not overlap with the machine network

Quick reference: pods per node by hostPrefix

hostPrefixSubnet sizeUsable pod IPs
/212,0482,046
/221,0241,022
/23512510
/24256254
/25128126
/266462
/273230
/281614

install-config.yaml snippet

networking:
  networkType: OVNKubernetes
  clusterNetwork:
    - cidr: 10.128.0.0/14   # adjust to your sizing
      hostPrefix: 23          # adjust pods/node target
  serviceNetwork:
    - 172.30.0.0/16
  machineNetwork:
    - cidr: 192.168.0.0/24   # must not overlap with clusterNetwork or serviceNetwork
Warning
clusterNetwork and serviceNetwork cannot be changed after installation. Size conservatively — it is always safe to choose a larger CIDR than currently needed.

Verify on a running cluster

oc get network cluster -o jsonpath='{.spec.clusterNetwork}' | jq .

Expected output:

[
  {
    "cidr": "10.128.0.0/14",
    "hostPrefix": 23
  }
]