When configuring Azure Kubernetes Service with Azure Container Network Interface (CNI), every pod gets an IP address of the subnet you’ve configured.
So how do you plan you address space? What factors should you consider?
- Each node consumes one IP.
- Each pod consumes one IP.
- Each internal LoadBalancer Service you anticipate consumes one IP.
- Azure reserves 5 IP addresses within each subnet.
- The Max pods per node is 250.
- The Max pods per nodes lower limit is 10.
- 30 pods is the minimum per cluster.
- Max nodes per cluster is 1000.
- When a cluster is upgraded a new node is added as part of the process which requires a minimum of one additional block of IP addresses to be available. Your node count is then n + 1.
- When you scale a cluster an additional node is added. Your node count is then n + number-of-additional-scaled-nodes-you-anticipate + 1.
With all that in mind the formula to calculate the number of IPs required for your cluster should look like this:
1requiredIPs = (nodes + 1 + scale) + ((nodes + 1 + scale) * maxPods) + isvc
where:
- nodes: Number of nodes (default 3)
- maxPods: Max pods per node (default 30)
- sacale: Number of expected scale nodes
- isvc: Number of expected internal LoadBalancer services
To help you with this I’ve created a small console program written in golang: aksip which performs the necessary validations and calculations for you.
Let’s say you want a 50 node cluster with one internal load balancer that also includes provision to scale up an additional 10 nodes:
Just run:
1aksip -n 50 -s 10
The output will show that you’ll need 1892 IP addresses and therefore a /21 subnet or larger:
1{
2 "nodes": 50,
3 "scale": 10,
4 "maxPods": 30,
5 "isvc": 1,
6 "requiredIPs": 1892,
7 "cidr": "/21"
8}
Hope it helps!!!
References:
Comments