Pod CIDR是分配给Kubernetes集群中Pod的专用IP地址范围,与节点IP完全分离。每个节点从较大的Pod CIDR中获得一个较小的/24块。例如:Flannel使用10.244.0.0/16(最多支持256个节点,每个节点一个/24),Calico默认使用192.168.0.0/16。CNI插件(Flannel、Calico、Cilium)负责管理这些分配。
Subnets and CIDR are two foundational concepts that every infrastructure engineer or DevOps practitioner must understand — from designing AWS VPCs and configuring Kubernetes, to simply understanding why your office network uses 192.168.1.x. This article explains everything from the basics to real-world practice.
2019Trusted since
B2BData solutions
Data·AIExpertise
Need data solutions for your business?
AlgoData has helped businesses with data engineering, analytics & AI since 2019.
An IPv4 address is a 32-bit number, typically written as four octets separated by dots. For example: 192.168.1.100 = 11000000.10101000.00000001.01100100 in binary.
Every IP address is divided into two parts:
Network part: Identifies the network (like an area code in a phone number)
Host part: Identifies the device within that network (like the subscriber number)
Private IP address ranges (reserved for internal networks, not directly routable on the internet):
Range
CIDR
Address Count
Common Use
10.0.0.0 – 10.255.255.255
10.0.0.0/8
~16.7 million
Large enterprise networks, cloud VPCs
172.16.0.0 – 172.31.255.255
172.16.0.0/12
~1 million
Docker bridge networks
192.168.0.0 – 192.168.255.255
192.168.0.0/16
~65K
Home routers, small office networks
What is a Subnet?
A subnet (subnetwork) is the practice of dividing a large IP network into smaller sub-networks. Each subnet has:
Network address: The first address of the subnet (cannot be assigned to a host)
Host addresses: Addresses that can be assigned to devices
Broadcast address: The last address (cannot be assigned to a host)
Why do we need subnets?
Security: Separate different zones (DMZ, internal, database)
Kubernetes uses a dedicated CIDR range for its pod network, completely separate from node IP addresses:
Bash
1# View pod CIDR for the cluster2kubectl get nodes -o wide
3# INTERNAL-IP column shows node IPs; POD-CIDR column shows each node's pod CIDR45# Check pod CIDR in kubeadm config6kubectl get configmap kubeadm-config -n kube-system -o yaml | grep podSubnet
78# View pod IPs across all namespaces9kubectl get pods -A -o wide
Default CNI plugins and their CIDRs:
Flannel: 10.244.0.0/16 — each node receives a /24 (up to 256 pods per node)
Without VLSM, every subnet would need to be large enough for the biggest office — wasting hundreds of IP addresses on segments that only need a handful.
CIDR /24 means the first 24 bits of the IP address are the network prefix, and the remaining 8 bits identify the host. With /24, you have 2^8 = 256 total addresses. Subtract 1 for the network address and 1 for the broadcast address, leaving 254 usable host addresses. For example: 192.168.1.0/24 can use 192.168.1.1 through 192.168.1.254.
QAre subnet mask 255.255.255.0 and /24 the same thing?
Yes, they are two representations of the same concept. 255.255.255.0 written in dotted-decimal: 255 = 11111111 (8 bits of 1), three octets of 255 = 24 bits of 1 → /24. CIDR (Classless Inter-Domain Routing) is a more concise and flexible notation because it can represent any prefix length without being restricted to classful A/B/C boundaries.
QWhat is a broadcast address?
The broadcast address is a special address at the end of each subnet, used to send a packet to ALL hosts within that subnet. Routers and switches do not forward broadcasts outside the subnet. In 192.168.1.0/24: broadcast = 192.168.1.255. In 10.0.0.0/28: broadcast = 10.0.0.15. This is why each subnet loses 2 addresses (network + broadcast) that cannot be assigned to hosts.
QWhy does AWS VPC typically use /16 for the VPC and /24 for subnets?
/16 provides 65,536 addresses — enough space for an entire large organization's cloud infrastructure with room to grow. /24 provides 251 usable addresses per subnet (AWS reserves 5 addresses) — sufficient for one workload tier (web tier, app tier, database tier). Using /24 for the entire VPC would exhaust address space as soon as you have multiple subnets.
QWhat is a Kubernetes pod CIDR?
Pod CIDR is a dedicated IP range allocated to pods inside a Kubernetes cluster, completely separate from node IPs. Each node is assigned a smaller /24 block from the larger pod CIDR. For example: Flannel uses 10.244.0.0/16 (supports up to 256 nodes each with a /24), Calico uses 192.168.0.0/16 by default. The CNI plugin (Flannel, Calico, Cilium) manages this allocation.
QWhat is VLSM and when should you use it?
VLSM (Variable Length Subnet Masking) is a technique that uses subnet masks of different lengths within the same network — instead of requiring all subnets to be the same size. For example: a large office uses /22 (1022 hosts), a small department uses /26 (62 hosts), a point-to-point router link uses /30 (2 hosts). VLSM saves IP address space and accurately reflects the actual needs of each network segment.