<p>I have an AKS cluster with autoscaling enabled, where rules are based on avg CPU.
<a href="https://i.stack.imgur.com/FxeML.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FxeML.png" alt="enter image description here" /></a></p>
<p>The default number of nodes is := <code>default = 5</code>, <code>min = 4</code> and <code>max = 7</code> and the scaling rules have a cooldown of 5 minutes.</p>
<p>I am trying to understand why the scaling rules cause continuous up- and downscaling
<a href="https://i.stack.imgur.com/YPgCL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YPgCL.png" alt="enter image description here" /></a></p>
<p>while the average CPU usage is low enough for 4 nodes.</p>
<p><a href="https://i.stack.imgur.com/nWHNX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nWHNX.png" alt="enter image description here" /></a></p>
<p>What I found even more surprising is that the Activity Log only highlights down scale events! They are consistent with a cooldown of 5 minutes, so AKS thinks that he's downscaling all the time, magically new nodes appear, and it keeps downscaling?</p>
<p>Who can explain what's going on here and what is causing it?</p>
<p><a href="https://i.stack.imgur.com/A8wfk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A8wfk.png" alt="enter image description here" /></a></p>

Casper Dijkstra
<p>•   Since, you have set the default node count in a node pool to be 5 but the CPU average utilization is not clicking 40% too so, it is automatically scaling it down to the lowest node count in the node pool configured, i.e., 4 and once, that node count is reached, it satisfies the auto scale down condition, and it once again scales up to the default node count of 5. This explains the continuous scaling up and down of the nodes in the first picture posted.</p>
<p>•   While the continuous scaling down events that are captured in activity log at a default duration of 5 minutes is a cooldown of scaling events that have default delay of 5 minutes according to the below Microsoft documentation. And only scale down events are captured because CPU initialization and utilization after scaling down to 4 nodes to the default node count of 5 in a node pool trigger only scale down events according to horizontal auto scaler rules. Thus, only scale down events are recorded in the activity log: -</p>
<p><a href="https://learn.microsoft.com/en-us/azure/aks/concepts-scale#cooldown-of-scaling-events" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/aks/concepts-scale#cooldown-of-scaling-events</a></p>
<p>Also, find the below Kubernetes documentation for reference: -</p>
<p><a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-cooldown-delay" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-cooldown-delay</a></p>
