%3CLINGO-SUB%20id%3D%22lingo-sub-1474990%22%20slang%3D%22en-US%22%3EAzure%20Kubernetes%20Service%20Cluster%20Capacity%20Planning%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1474990%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAny%20AKS%20cluster%20designed%20to%20run%20in%20production%20should%20at%20some%20point%20(preferably%20prior%20to%20being%20created%20%3CIMG%20class%3D%22lia-deferred-image%20lia-image-emoji%22%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Fhtml%2Fimages%2Femoticons%2Fsmile_40x40.gif%22%20alt%3D%22%3Asmile%3A%22%20title%3D%22%3Asmile%3A%22%20%2F%3E)%20go%20through%20some%20capacity%20planning%20to%20ensure%20that%20your%20expected%20workload%20will%20be%20able%20to%20run%20without%20any%20issues.%3C%2FP%3E%0A%3CP%3EThis%20article%20focuses%20on%20network%20capacity%20planning%20of%20AKS%20clusters%20but%20keep%20in%20mind%20folks%20that%20it%20is%20important%20that%20for%20a%20complete%20capacity%20planning%2C%20compute%20and%20storage%20resources%20must%20also%20be%20considered.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EHow%20many%20nodes%20do%20I%20need%20in%20my%20AKS%20cluster%3F%3C%2FLI%3E%0A%3CLI%3EDoes%20the%20size%20of%20the%20subnet%20of%20my%20nodes%20matter%3F%3C%2FLI%3E%0A%3CLI%3EHow%20many%20pods%20could%20be%20run%20on%20the%20cluster%3F%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CBR%20%2F%3EIf%20you%20have%20ever%20deployed%20an%20AKS%20cluster%20before%2C%20you%20might%20already%20have%20asked%20yourself%20those%20questions%20above%2C%20probably%20found%20some%20answers%20but%20eventually%20decided%20to%20go%20with%20the%20cluster%20default%20settings%20and%20if%20any%20changes%20were%20to%20be%20made%2C%20you%20would%20just%20make%20them%20down%20the%20road%20as%20you%20get%20more%20visibility%20into%20the%20workload%20running%20on%20your%20clusters%20or%20when%20starting%20facing%20issues.%3CBR%20%2F%3EI%20know%20that%20most%20of%20us%20have%20more%20than%20once%20taken%20this%20approach%20but%20the%20main%20issue%20here%20is%20that%26nbsp%3Bsome%20settings%20directly%20or%20indirectly%20linked%20to%20your%20AKS%20clusters%20cannot%20be%20changed%20after%20the%20fact%20post%20deployment%20such%20as%20AKS%20%3CSTRONG%3Esubnet%20IP%20range%3C%2FSTRONG%3E%20and%20%3CSTRONG%3Emax%20pods%20per%20node%3C%2FSTRONG%3E%20settings.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EGoing%20through%20proper%20capacity%20planning%20will%20bring%20architects%2C%20IT%20and%20application%20operators%20answers%20to%20most%20of%20the%20resource%20capacity%20questions%20that%20will%20arise%20at%20some%20point%20during%20the%20scoping%2C%20design%20or%20implementation%20phase%20of%20any%20projects%20big%20or%20small.%3CBR%20%2F%3EThis%20will%20be%20achieved%20by%20taking%20into%20consideration%20the%20impact%20of%20your%20AKS%20cluster%20design%20as%20well%20as%20the%20technical%20requirements%20and%20limitations%20of%20the%20service.%3CBR%20%2F%3EThe%20process%20is%20to%20be%20completed%20in%20that%20order%20since%20the%20output%20of%20a%20task%20is%20used%20as%20an%20input%20of%20the%20next%20one%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EAKS%20network%20plugins%3C%2FLI%3E%0A%3CLI%3EAKS%20subnet%20size%3C%2FLI%3E%0A%3CLI%3EAKS%20cluster%20size%3C%2FLI%3E%0A%3CLI%3EAKS%20pod%20capacity%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3ELet%E2%80%99s%20now%20go%20over%20them%20one%20by%20one%20with%20some%20examples.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSTRONG%3E1.%20AKS%20network%20plugins%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThe%20first%20decision%20you%20have%20to%20make%20in%20regards%20to%20networking%20with%20Kubernetes%20clusters%20in%20general%20is%20the%20choice%20of%20the%20network%20plugin%20which%20is%20used%20on%20all%20the%20nodes%20for%20intra%2Finter%20pods%20and%20nodes%20communications.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EAKS%20gives%20you%20have%202%20options%3A%20%3CSTRONG%3EKubenet%26nbsp%3B%3C%2FSTRONG%3E(also%20referred%20to%20as%20%E2%80%98Basic%E2%80%99%20in%20Azure%20Poral)%20and%20%3CSTRONG%3EAzure%20CNI%3C%2FSTRONG%3E%20(also%20referred%20to%20as%20%E2%80%98Advanced%E2%80%99%20in%20the%20Azure%20portal).%3CBR%20%2F%3EIt%20is%20one%20of%20the%20settings%20that%20once%20configured%20it%20cannot%20be%20changed%20unless%20the%20entire%20cluster%20is%20recreated.%3CBR%20%2F%3EThis%20topic%20alone%20around%20network%20plugins%20is%20worth%20its%20own%20article%20so%20I%20will%20not%20dive%20too%20deep%20into%20it%2C%20I%20just%20want%20to%20give%20you%20some%20insights%20to%20help%20you%20make%20a%20decision%20on%20which%20one%20to%20choose.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EKubenet%20is%20considered%20as%20a%20basic%20network%20plugin%20for%20Kubernetes%20that%20is%20implemented%20on%20Linux%20machines%20only.%3CBR%20%2F%3EIt%20offers%20limited%20functionalities%20and%20due%20to%20its%20design%2C%20routing%20rules%20must%20be%20implemented%20on%20top%20of%20it%20to%20enable%20inter%20cluster%20node%20communication%20which%20increases%20the%20complexity%20of%20cluster%20network%20management.%20See%20link%20below%20for%20more%20details%3A%3CBR%20%2F%3E%5B%23%24dp3%5D%3CA%20href%3D%22https%3A%2F%2Fkubernetes.io%2Fdocs%2Fconcepts%2Fextend-kubernetes%2Fcompute-storage-net%2Fnetwork-plugins%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CBR%20%2F%3Ehttps%3A%2F%2Fkubernetes.io%2Fdocs%2Fconcepts%2Fextend-kubernetes%2Fcompute-storage-net%2Fnetwork-plugins%2F%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EIt%20has%20one%20major%20advantage%20though%2C%20it%20saves%20IP%20addresses%20by%20having%20each%20cluster%20node%20run%20its%20own%20NAT-ed%20%2F24%20CIDR%20subnet%20for%20its%20pods.%20This%20network%20plugin%20is%20fully%20supported.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EHowever%2C%20to%20better%20understand%20the%20impact%20of%20Kubenet%E2%80%99s%20limitations%2C%20I%20listed%20below%20some%20of%20them%20(as%20of%20this%20writing).%20Also%2C%20it%20is%20not%20a%20complete%20list.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EKubenet%20does%20not%20support%3A%3CUL%20class%3D%22lia-list-style-type-circle%22%3E%0A%3CLI%3EAzure%20Virtual%20Nodes%3C%2FLI%3E%0A%3CLI%3EAzure%20Network%20Policies%3C%2FLI%3E%0A%3CLI%3EWindows%20node%20pools%3C%2FLI%3E%0A%3CLI%3EShared%20AKS%20cluster%20subnets%20(having%20multiple%20AKS%20clusters%20running%20in%20the%20same%20subnet)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3EMax%20nodes%20per%20cluster%20with%20Kubenet%20is%20400%20since%20UDRs%20do%20not%20support%20more%20than%20400%20routes%3C%2FLI%3E%0A%3CLI%3ECannot%20query%20DNS%20Private%20Zones%20from%20a%20Pod%20in%20Kubenet%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CBR%20%2F%3EMoreover%2C%20most%20of%20the%20new%20AKS%20functionalities%20are%20first%20developed%20with%20Azure%20CNI%20and%20then%20when%20technically%20compatible%2C%20they%20are%20adapted%20to%20Kubenet.%20Here%20are%20below%20some%20examples%20of%20those%20features%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EApplication%20Gateway%20Ingress%20Controller%3C%2FLI%3E%0A%3CLI%3EAllocating%20a%20separate%20subnet%20per%20node%20pool%3C%2FLI%3E%0A%3CLI%3EOutbound%20type%20of%20userDefinedRouting%20(AKS%20does%20not%20automatically%20provision%20a%20public%20IP%20address%20for%20the%20Standard%20Load%20Balancer%20frontend)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CBR%20%2F%3EMoving%20on%20in%20this%20article%20we%20will%20choose%20the%20%3CSTRONG%3EAzure%20CNI%3C%2FSTRONG%3E%20network%20plugin%20and%20the%20first%20thing%20I%20would%20recommend%20for%20anyone%20designing%20an%20AKS%20cluster%20with%20Azure%20CNI%20is%20to%20read%20the%20following%20documentation%3A%3CBR%20%2F%3E-ERR%3AREF-NOT-FOUND-%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Faks%2Fconfigure-azure-cni%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Faks%2Fconfigure-azure-cni%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSTRONG%3E2.%20AKS%20subnet%20size%3C%2FSTRONG%3E%3CBR%20%2F%3EThe%20first%20implication%20of%20choosing%20Azure%20CNI%20as%20the%20network%20plugin%20for%20your%20AKS%20clusters%20is%20that%20all%20user*%20and%20system**%20pod%20IP%E2%80%99s%20are%20reserved%20upfront%20in%20your%20AKS%20subnet%20based%20on%20the%20max%20pods%20per%20node%20setting%E2%80%99s%20value%20times%20the%20number%20of%20nodes%20in%20your%20cluster%20at%20any%20time%20(example%20below).%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E*user%20pods%20are%20any%20pods%20that%20your%20business%2Finfrastructure%20applications%20are%20composed%20of.%3CBR%20%2F%3E**system%20pods%20are%20any%20pods%20either%20required%20by%20Kubernetes%2FAKS%20to%20function%20properly%20such%20as%20CoreDNS%20and%20tunnelfront%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3ECheck%20out%20in%20the%20below%20link%20the%20notion%20of%20user%20and%20system%20node%20pools%3A%3CBR%20%2F%3E-ERR%3AREF-NOT-FOUND-%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Faks%2Fuse-system-pools%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Faks%2Fuse-system-pools%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EFor%20instance%2C%20if%20you%20set%20the%20number%20of%20nodes%20in%20your%20cluster%20to%203%20and%20the%20max%20pods%20per%20node%20to%2050%20(default%20value%20is%2030)%2C%20the%20AKS%20subnet%20will%20reserve%203%20x%2050%20%3D150%20IP%E2%80%99s%20in%20your%20AKS%20subnet%20regardless%20of%20the%20actual%20consumption%20of%20IP%20addresses%20by%20user%20or%20system%20pods%20inside%20your%20cluster.%3CBR%20%2F%3ECluster%20deployment%20would%20fail%20if%20not%20all%20IP%E2%80%99s%20could%20be%20reserved.%3CBR%20%2F%3EIt%20also%20applies%20during%20the%20upgrade%20of%20your%20AKS%20node%20pools%20where%20a%20temporary%20additional%20node%20is%20created%20prior%20to%20starting%20the%20cordon%20and%20drain%20process%20of%20any%20other%20existing%20node%2C%20if%20there%20is%20not%20enough%20IP%E2%80%99s%20available%20in%20your%20AKS%20subnet%2C%20the%20upgrade%20fails%20right%20away%20(pre-check%20performed).%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3ENow%20let%E2%80%99s%20go%20over%20a%20simple%20use%20case%20to%20learn%20how%20to%20properly%20size%20your%20AKS%20subnet%20and%20cluster.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EWhat%20is%20the%20minimum%20size%20required%20for%20a%20dedicated%20AKS%20subnet%20to%20fit%20in%20a%20single-node%20AKS%20cluster%20with%20a%20max%20pods%20per%20node%20of%2030%20(default)%20and%20using%20Azure%20CNI%20as%20a%20network%20plugin%3F%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3ELet%E2%80%99s%20do%20the%20math!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E5%20IP%E2%80%99s%20reserved%20by%20Azure%20VNet%20within%20each%20subnet%20(-ERR%3AREF-NOT-FOUND-%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-network%2Fvirtual-networks-faq%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-network%2Fvirtual-networks-faq%3C%2FA%3E)%3CUL%20class%3D%22lia-list-style-type-circle%22%3E%0A%3CLI%3Ex.x.x.0%3A%20Network%20address%3C%2FLI%3E%0A%3CLI%3Ex.x.x.1%3A%20Reserved%20by%20Azure%20for%20the%20default%20gateway%3C%2FLI%3E%0A%3CLI%3Ex.x.x.2%2C%20x.x.x.3%3A%20Reserved%20by%20Azure%20to%20map%20the%20Azure%20DNS%20IPs%20to%20the%20VNet%20space%3C%2FLI%3E%0A%3CLI%3Ex.x.x.255%3A%20Network%20broadcast%20address%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3E1%20IP%20assigned%20to%20the%20network%20interface%20of%20the%201-node%20in%20your%20cluster%3CUL%20class%3D%22lia-list-style-type-circle%22%3E%0A%3CLI%3Ex.x.x.x.4%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3E30%20IP%E2%80%99s%20reserved%20by%20Azure%20CNI%20which%20correspond%20to%20the%20max%20pods%20per%20node%3CUL%20class%3D%22lia-list-style-type-circle%22%3E%0A%3CLI%3Ex.x.x.x.5%20%E2%80%93%20x.x.x.35%20(1%20node)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CBR%20%2F%3ETotal%20required%20IP%E2%80%99s%20is%20the%20sum%20of%20the%20above%20IP%E2%80%99s%3A%205%20%2B%201%20%2B%2030%20%3D%2036.%3CBR%20%2F%3EAt%20this%20point%20you%20already%20know%20that%20a%20x.x.x.x%2F27%20subnet%20with%2032%20IP%E2%80%99s%20available%20is%20not%20enough%20so%20you%20will%20need%20at%20least%20a%20%2F26%20subnet%20with%2064%20IP%E2%80%99s%20available.%20Is%20that%20it%3F%20Almost%E2%80%A6%3CBR%20%2F%3ERemember%20that%20the%20AKS%20cluster%20upgrade%20process%20implies%20the%20creation%20of%20a%20temporary%20additional%20node%20which%20like%20any%20other%20nodes%20has%201%20IP%20assigned%20to%20its%20network%20interface%20and%2030%20IP%E2%80%99s%20reserved%20for%20the%20max%20pods%20per%20node%20so%20taking%20it%20into%20account%2C%20the%20new%20total%20required%20IP%E2%80%99s%20is%3A%2036%20%2B%201%20%2B%2030%20%3D%2067%3CBR%20%2F%3ENow%20you%20know%20that%20even%20a%20%2F26%20subnet%20with%2064%20IP%E2%80%99s%20available%20would%20not%20be%20sufficient%20and%20at%20least%20a%20%3CSTRONG%3E%2F25%20subnet%3C%2FSTRONG%3E%20with%20%3CSTRONG%3E128%3C%2FSTRONG%3E%20IP%E2%80%99s%20is%20required.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CSTRONG%3E3.%20AKS%20cluster%20size%3C%2FSTRONG%3E%3CBR%20%2F%3EFollowing%20along%20with%20our%20previous%20use%20case%2C%20we%20saw%20that%20a%20%2F25%20subnet%20with%20a%20max%20pods%20per%20node%20of%2030%20can%20hold%20a%202-node%20cluster%20but%20not%203%2C%20here%20is%20below%20the%20details%20of%20the%20reasoning%20to%20help%20you%20determine%20for%20each%20subnet%20size%20how%20many%20nodes%20you%20can%20fit%20it%20at%20most%3A%3CBR%20%2F%3E%2B1%20corresponds%20to%20the%20additional%20node%20automatically%20and%20temporarily%20added%20during%20AKS%20node%20pool%20upgrades.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3E2%3C%2FSTRONG%3E-node%20cluster%3A%205%20%2B%20(%3CSTRONG%3E2%3C%2FSTRONG%3E%2B1)%20%2B%20(30%20x%20(%3CSTRONG%3E2%3C%2FSTRONG%3E%2B1))%20%3D%2098%20is%20less%20or%20equal%20to%20128%20%26lt%3B%3D%26gt%3B%20%2F25%20%3CFONT%20color%3D%22%23339966%22%3EOK%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3E3%3C%2FSTRONG%3E-node%20cluster%3A%205%2B%20(%3CSTRONG%3E3%3C%2FSTRONG%3E%2B1)%20%2B%20(30%20x%20(%3CSTRONG%3E3%3C%2FSTRONG%3E%2B1))%20%3D%20129%20is%20greater%20than%20128%20%26lt%3B%3D%26gt%3B%20%2F25%20%3CFONT%20color%3D%22%23FF0000%22%3EKO%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20you%20might%20have%20figured%20out%20already%20if%20you%20lower%20the%20max%20pods%20per%20node%2C%20you%20will%20be%20able%20to%20fit%20more%20nodes%20into%20your%20AKS%20subnet.%3CBR%20%2F%3EFor%20instance%2C%20a%20max%20pod%20per%20node%20of%2029%20instead%20of%2030%20(by%20default)%20would%20allow%20you%20to%20fit%203%20nodes%20in%20a%20%2F25%20subnet%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3E3%3C%2FSTRONG%3E-node%20cluster%3A%205%20%2B%20(%3CSTRONG%3E3%3C%2FSTRONG%3E%2B1)%20%2B%20(29%20x%20(%3CSTRONG%3E3%3C%2FSTRONG%3E%2B1))%20%3D%20125%20is%20less%20than%20128%20%26lt%3B%3D%26gt%3B%20%2F25%26nbsp%3B%3CFONT%20color%3D%22%23339966%22%3EOK%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CBR%20%2F%3EYou%20could%20make%20use%20of%20the%20following%20very%20simple%20Excel%20table%20to%20help%20you%20with%20your%20capacity%20planning.%3CBR%20%2F%3EAn%20additional%20reserved%20IP%20has%20been%20added%20in%20column%20B%20which%20represents%20the%20private%20endpoint%20of%20a%20private%20AKS%20cluster.%3CBR%20%2F%3EHighlighted%20in%20yellow%20are%20the%20formulas%20used%20in%20the%20indicated%20columns%20with%20the%20red%20arrows%20(C%20and%20E)%2C%20the%20other%20columns%20hold%20static%20values.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22aksblogteaser.png%22%20style%3D%22width%3A%20740px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200668i4BD6DAD26F9D113F%2Fimage-dimensions%2F740x230%3Fv%3D1.0%22%20width%3D%22740%22%20height%3D%22230%22%20title%3D%22aksblogteaser.png%22%20alt%3D%22aksblogteaser.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EIf%20you%20are%20looking%20to%20fit%20more%20nodes%20in%20your%20cluster%2C%20keep%20an%20eye%20on%20the%20size%2FSKU%20of%20your%20nodes%2FVM%E2%80%99s%20as%20you%20might%20not%20need%20as%20much%20compute%20on%20individual%20nodes%20since%20you%20will%20be%20able%20to%20achieve%20the%20same%20total%20amount%20of%20memory%20and%20CPU%20with%20more%20nodes%20of%20a%20smaller%20size.%20The%20Kubernetes%20scheduler%20will%20then%20do%20the%20job%20of%20spreading%20evenly%20the%20workload%20across%20all%20the%20nodes.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSTRONG%3E4.%20AKS%20pod%20capacity%3C%2FSTRONG%3E%3CBR%20%2F%3EAs%20seen%20earlier%20in%20order%20for%20pods%20from%20your%20applications%20(user%20pods)%20to%20get%20IP%E2%80%99s%20assigned%20in%20the%20cluster%2C%20those%20IP%E2%80%99s%20must%20be%20reserved%20by%20Azure%20CNI%20at%20the%20creation%20of%20each%20node%20and%20they%20must%20not%20already%20be%20assigned%20to%20system%20pods.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3ELet%E2%80%99s%20try%20to%20determine%20how%20many%20user%20pods%20can%20be%20created%20in%20a%203-node%20cluster%20configured%20with%20the%20default%20max%20pods%20per%20node%20(30).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20AKS%201.17.4%20by%20using%20the%20following%20command%20%E2%80%98%26gt%3Bkubectl%20get%20pods%20-A%20-o%20wide%E2%80%99%20right%20after%20the%20deployment%20of%20your%20AKS%20cluster%2C%20you%20can%20observe%20that%20there%20are%2016%20system%20pods%20running%20(if%20no%20add-ons%20selected)%20using%205%20different%20IP%20addresses%20(some%20pods%20such%20as%20kube-proxy%20or%20azure-ip-masq-agent%20share%20the%20same%20IP%20as%20the%20nodes%20they%20are%20hosted%20in%2C%20hence%20the%20difference).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAt%20the%20end%2C%203%20nodes%20x%2030%20max%20pods%20per%20node%20%E2%80%93%2016%20system%20pods%20%3D%20%3CSTRONG%3E74%3C%2FSTRONG%3E%20user%20pods%20can%20be%20created.%3C%2FP%3E%0A%3CP%3EKeep%20in%20mind%20the%20existence%20of%20Kubernetes%20system%20daemonSet%20resources%20to%20understand%20the%20spread%20of%20the%20system%20pods%20across%20all%20the%20nodes%20of%20the%20cluster.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EIt%20does%20not%20matter%20here%20that%20there%20are%20more%20IP%E2%80%99s%20reserved%20by%20Azure%20CNI%20and%20available%20in%20the%20cluster%203x30-5%3D85%20since%20the%20max%20pods%20per%20node%20is%20a%20hard%20limit%20that%20cannot%20be%20exceeded.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EI%20hope%20you%20now%20fill%20much%20more%20confident%20in%20designing%20and%20configuring%20your%20AKS%20clusters%20to%20meet%20all%20your%20requirements%20and%20needs.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EOuissame%20Bekada%3CBR%20%2F%3ESenior%20Premier%20Field%20Engineer%2C%20Cloud%20and%20Infrastructure%2C%20France%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EFollow%20me%20on%20-ERR%3AREF-NOT-FOUND-Twitter%20or%2Fand%20-ERR%3AREF-NOT-FOUND-LinkedIn%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1474990%22%20slang%3D%22en-US%22%3E%3CP%3EDesign%20your%20Azure%20Kubernetes%20Service%20(AKS)%20clusters%20with%20a%20proper%20network%20capacity%20planning.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22aksblogteaser.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F199552i9A5D1A888F615CA7%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22aksblogteaser.png%22%20alt%3D%22aksblogteaser.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1474990%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Eouissamebekada%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

 

Any AKS cluster designed to run in production should at some point (preferably prior to being created :smile:) go through some capacity planning to ensure that your expected workload will be able to run without any issues.

This article focuses on network capacity planning of AKS clusters but keep in mind folks that it is important that for a complete capacity planning, compute and storage resources must also be considered.

 

  • How many nodes do I need in my AKS cluster?
  • Does the size of the subnet of my nodes matter?
  • How many pods could be run on the cluster?


If you have ever deployed an AKS cluster before, you might already have asked yourself those questions above, probably found some answers but eventually decided to go with the cluster default settings and if any changes were to be made, you would just make them down the road as you get more visibility into the workload running on your clusters or when starting facing issues.
I know that most of us have more than once taken this approach but the main issue here is that some settings directly or indirectly linked to your AKS clusters cannot be changed after the fact post deployment such as AKS subnet IP range and max pods per node settings.


Going through proper capacity planning will bring architects, IT and application operators answers to most of the resource capacity questions that will arise at some point during the scoping, design or implementation phase of any projects big or small.
This will be achieved by taking into consideration the impact of your AKS cluster design as well as the technical requirements and limitations of the service.
The process is to be completed in that order since the output of a task is used as an input of the next one:

  1. AKS network plugins
  2. AKS subnet size
  3. AKS cluster size
  4. AKS pod capacity

Let’s now go over them one by one with some examples.



1. AKS network plugins

The first decision you have to make in regards to networking with Kubernetes clusters in general is the choice of the network plugin which is used on all the nodes for intra/inter pods and nodes communications.


AKS gives you have 2 options: Kubenet (also referred to as ‘Basic’ in Azure Poral) and Azure CNI (also referred to as ‘Advanced’ in the Azure portal).
It is one of the settings that once configured it cannot be changed unless the entire cluster is recreated.
This topic alone around network plugins is worth its own article so I will not dive too deep into it, I just want to give you some insights to help you make a decision on which one to choose.


Kubenet is considered as a basic network plugin for Kubernetes that is implemented on Linux machines only.
It offers limited functionalities and due to its design, routing rules must be implemented on top of it to enable inter cluster node communication which increases the complexity of cluster network management. See link below for more details:
https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/
It has one major advantage though, it saves IP addresses by having each cluster node run its own NAT-ed /24 CIDR subnet for its pods. This network plugin is fully supported.


However, to better understand the impact of Kubenet’s limitations, I listed below some of them (as of this writing). Also, it is not a complete list.

 

  • Kubenet does not support:
    • Azure Virtual Nodes
    • Azure Network Policies
    • Windows node pools
    • Shared AKS cluster subnets (having multiple AKS clusters running in the same subnet)
  • Max nodes per cluster with Kubenet is 400 since UDRs do not support more than 400 routes
  • Cannot query DNS Private Zones from a Pod in Kubenet


Moreover, most of the new AKS functionalities are first developed with Azure CNI and then when technically compatible, they are adapted to Kubenet. Here are below some examples of those features:

  • Application Gateway Ingress Controller
  • Allocating a separate subnet per node pool
  • Outbound type of userDefinedRouting (AKS does not automatically provision a public IP address for the Standard Load Balancer frontend)


Moving on in this article we will choose the Azure CNI network plugin and the first thing I would recommend for anyone designing an AKS cluster with Azure CNI is to read the following documentation:
https://docs.microsoft.com/en-us/azure/aks/configure-azure-cni



2. AKS subnet size
The first implication of choosing Azure CNI as the network plugin for your AKS clusters is that all user* and system** pod IP’s are reserved upfront in your AKS subnet based on the max pods per node setting’s value times the number of nodes in your cluster at any time (example below).


*user pods are any pods that your business/infrastructure applications are composed of.
**system pods are any pods either required by Kubernetes/AKS to function properly such as CoreDNS and tunnelfront


Check out in the below link the notion of user and system node pools:
https://docs.microsoft.com/en-us/azure/aks/use-system-pools


For instance, if you set the number of nodes in your cluster to 3 and the max pods per node to 50 (default value is 30), the AKS subnet will reserve 3 x 50 =150 IP’s in your AKS subnet regardless of the actual consumption of IP addresses by user or system pods inside your cluster.
Cluster deployment would fail if not all IP’s could be reserved.
It also applies during the upgrade of your AKS node pools where a temporary additional node is created prior to starting the cordon and drain process of any other existing node, if there is not enough IP’s available in your AKS subnet, the upgrade fails right away (pre-check performed).


Now let’s go over a simple use case to learn how to properly size your AKS subnet and cluster.


What is the minimum size required for a dedicated AKS subnet to fit in a single-node AKS cluster with a max pods per node of 30 (default) and using Azure CNI as a network plugin?


Let’s do the math!

 

  • 5 IP’s reserved by Azure VNet within each subnet (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-faq)
    • x.x.x.0: Network address
    • x.x.x.1: Reserved by Azure for the default gateway
    • x.x.x.2, x.x.x.3: Reserved by Azure to map the Azure DNS IPs to the VNet space
    • x.x.x.255: Network broadcast address
  • 1 IP assigned to the network interface of the 1-node in your cluster
    • x.x.x.x.4
  • 30 IP’s reserved by Azure CNI which correspond to the max pods per node
    • x.x.x.x.5 – x.x.x.35 (1 node)


Total required IP’s is the sum of the above IP’s: 5 + 1 + 30 = 36.
At this point you already know that a x.x.x.x/27 subnet with 32 IP’s available is not enough so you will need at least a /26 subnet with 64 IP’s available. Is that it? Almost…
Remember that the AKS cluster upgrade process implies the creation of a temporary additional node which like any other nodes has 1 IP assigned to its network interface and 30 IP’s reserved for the max pods per node so taking it into account, the new total required IP’s is: 36 + 1 + 30 = 67
Now you know that even a /26 subnet with 64 IP’s available would not be sufficient and at least a /25 subnet with 128 IP’s is required.


3. AKS cluster size
Following along with our previous use case, we saw that a /25 subnet with a max pods per node of 30 can hold a 2-node cluster but not 3, here is below the details of the reasoning to help you determine for each subnet size how many nodes you can fit it at most:
+1 corresponds to the additional node automatically and temporarily added during AKS node pool upgrades.

 

  • 2-node cluster: 5 + (2+1) + (30 x (2+1)) = 98 is less or equal to 128 <=> /25 OK
  • 3-node cluster: 5+ (3+1) + (30 x (3+1)) = 129 is greater than 128 <=> /25 KO

 

As you might have figured out already if you lower the max pods per node, you will be able to fit more nodes into your AKS subnet.
For instance, a max pod per node of 29 instead of 30 (by default) would allow you to fit 3 nodes in a /25 subnet:

 

  • 3-node cluster: 5 + (3+1) + (29 x (3+1)) = 125 is less than 128 <=> /25 OK


You could make use of the following very simple Excel table to help you with your capacity planning.
An additional reserved IP has been added in column B which represents the private endpoint of a private AKS cluster.
Highlighted in yellow are the formulas used in the indicated columns with the red arrows (C and E), the other columns hold static values.

 

aksblogteaser.png


If you are looking to fit more nodes in your cluster, keep an eye on the size/SKU of your nodes/VM’s as you might not need as much compute on individual nodes since you will be able to achieve the same total amount of memory and CPU with more nodes of a smaller size. The Kubernetes scheduler will then do the job of spreading evenly the workload across all the nodes.



4. AKS pod capacity
As seen earlier in order for pods from your applications (user pods) to get IP’s assigned in the cluster, those IP’s must be reserved by Azure CNI at the creation of each node and they must not already be assigned to system pods.


Let’s try to determine how many user pods can be created in a 3-node cluster configured with the default max pods per node (30).

 

In AKS 1.17.4 by using the following command ‘>kubectl get pods -A -o wide’ right after the deployment of your AKS cluster, you can observe that there are 16 system pods running (if no add-ons selected) using 5 different IP addresses (some pods such as kube-proxy or azure-ip-masq-agent share the same IP as the nodes they are hosted in, hence the difference).

 

At the end, 3 nodes x 30 max pods per node – 16 system pods = 74 user pods can be created.

Keep in mind the existence of Kubernetes system daemonSet resources to understand the spread of the system pods across all the nodes of the cluster.


It does not matter here that there are more IP’s reserved by Azure CNI and available in the cluster 3x30-5=85 since the max pods per node is a hard limit that cannot be exceeded.


I hope you now fill much more confident in designing and configuring your AKS clusters to meet all your requirements and needs.

 


Ouissame Bekada
Senior Premier Field Engineer, Cloud and Infrastructure, France


Follow me on Twitter or/and LinkedIn