AKS networking (kubenet, Azure CNI) - Time & Space Complexity
We want to understand how the time to set up networking in AKS changes as the number of nodes or pods grows.
Specifically, how does the choice between kubenet and Azure CNI affect this growth?
Analyze the time complexity of pod IP assignment during AKS cluster scaling.
// Example: Assign IPs to pods when nodes are added
for each node in cluster {
for each pod on node {
assign IP address using network plugin
}
}
This sequence shows how IP addresses are assigned to pods on each node using either kubenet or Azure CNI.
Look at what repeats as the cluster grows:
- Primary operation: Assigning IP addresses to pods via network plugin calls.
- How many times: Once per pod, across all nodes.
As you add more nodes and pods, the number of IP assignments grows.
| Input Size (pods) | Approx. API Calls/Operations |
|---|---|
| 10 | 10 IP assignments |
| 100 | 100 IP assignments |
| 1000 | 1000 IP assignments |
Pattern observation: The number of IP assignments grows directly with the number of pods.
Time Complexity: O(n)
This means the time to assign IPs grows linearly with the number of pods in the cluster.
[X] Wrong: "Adding more nodes does not affect IP assignment time because nodes work independently."
[OK] Correct: Even if nodes work independently, each pod still needs an IP assigned, so total work grows with total pods.
Understanding how network setup scales helps you design efficient clusters and troubleshoot performance as they grow.
What if the network plugin cached IP assignments instead of assigning them each time? How would the time complexity change?