AKS icon indicating copy to clipboard operation
AKS copied to clipboard

[BUG] Cluster Autoscaler clashes with Scale-down Mode deallocate

Open dbaur opened this issue 1 year ago • 38 comments

Describe the bug When using scale-down mode deallocate in combination with the cluster autoscaler, the Not-Ready nodes in the cluster can cause autoscaler to stop considering node pools or to stop working completely.

When using scale-down mode deallocate, on scale-down nodes are only deallocated, leaving them in the cluster with the state Not Ready. Cluster Autoscaler on the other hand has the settings ok-total-unready-count and max-total-unready-percentage with defaults values of 3 and 45% respectively. Once the number of deallocated nodes in a node pool reaches 3, the node pool will no longer be scaled and once the complete cluster reaches 45% Not Ready nodes, the autoscaler will halt completely.

To Reproduce Use multiple nodepools within a cluster and enable scale-down mode deallocate. First scale to like 10 nodes and afterwards scale-down to 1 node so that 9 nodes get deallocated. Afterwards schedule workload on the cluster. The nodepool will be disregarded, and autoscaler will e.g. log:

Found: 9 instances in deallocated state, returning target size: 0 for scaleSet scaleSetName

Expected behavior In general, I would wish that autoscaler and scale-down mode Deallocate would work together, but there are multiple solutions to this issue:

  • inform the user that when using scale-down mode deallocate that he needs to address those settings. Easiest solution, but more or less disables the auto-scaler settings which exist for a reason
  • no longer mark deallocated nodes as Not Ready but remove them from the cluster.
  • make auto-scaler aware that there is a difference between failed nodes and deallocate nodes, and he should only stop if the nodes are failed (i.e. ignore deallocated nodes for this limit)

Environment (please complete the following information):

  • Kubernetes version: 1.31.10

dbaur avatar Aug 14 '25 11:08 dbaur

Hi @dbaur, thanks for reporting this issue. The AKS team is investigating the deallocate behavior and will add this to our backlog.

julia-yin avatar Aug 28 '25 22:08 julia-yin

@dbaur - are you manually scaling it up and then forcing autoscaler to scale down?

Are the pods being scheduled in other nodepools when you try to deploy pods again ?

kevinkrp93 avatar Aug 29 '25 05:08 kevinkrp93

No, autoscaler performs the initial scale-up and scale-down, which leaves the nodes in Not Ready state due to scale-down mode Deallocate.

Towards your second question: depends. It either ignores the node pool and schedules to other node pools, or it doesn't scale at all once the overall cluster limit is reached (i.e. max-total-unready-percentage is reached cluster wide)

dbaur avatar Sep 08 '25 13:09 dbaur

no updates on this issue

kevinkrp93 avatar Nov 13 '25 21:11 kevinkrp93

This issue needs attention of @kevinkrp93, @wdarko1. Please provide an update on the investigation progress. Thanks!

This issue needs attention of @kevinkrp93, @wdarko1. Please provide an update on the investigation progress. Thanks!

This issue needs attention of @kevinkrp93, @wdarko1. Please provide an update on the investigation progress. Thanks!

This issue needs attention of @kevinkrp93, @wdarko1. Please provide an update on the investigation progress. Thanks!

This issue needs attention of @kevinkrp93, @wdarko1. Please provide an update on the investigation progress. Thanks!

This issue needs attention of @kevinkrp93, @wdarko1. Please provide an update on the investigation progress. Thanks!

This issue needs attention of @kevinkrp93, @wdarko1. Please provide an update on the investigation progress. Thanks!

This issue needs attention of @kevinkrp93, @wdarko1. Please provide an update on the investigation progress. Thanks!

This issue needs attention of @kevinkrp93, @wdarko1. Please provide an update on the investigation progress. Thanks!

This issue needs attention of @kevinkrp93, @wdarko1. Please provide an update on the investigation progress. Thanks!

This issue needs attention of @kevinkrp93, @wdarko1. Please provide an update on the investigation progress. Thanks!

This issue needs attention of @kevinkrp93, @wdarko1. Please provide an update on the investigation progress. Thanks!

One possible gotcha here is that our current implementation only works if the Deallocate nodepool has cluster autoscaling enabled.

However, its nodes are used to calculate cluster health regardless. So if the customer disabled autoscaling on that nodepool, the deallocated nodes are considered NotReady and the cluster is unhealthy.

We will look into guarding against this, but I wonder if that's the situation @dbaur ran into? I was unable to reproduce on 1.33 (using your steps) when the deallocate mode nodepool had autoscaling enabled.

rakechill avatar Mar 18 '26 21:03 rakechill

This issue needs attention of @kevinkrp93, @wdarko1. Please provide an update on the investigation progress. Thanks!

This issue needs attention of @kevinkrp93, @wdarko1. Please provide an update on the investigation progress. Thanks!

This issue needs attention of @kevinkrp93, @wdarko1. Please provide an update on the investigation progress. Thanks!