Cluster Autoscaler scale-down protection¶
Cluster Autoscaler scale-down protection refers to the set of conditions and configurations that prevent the Cluster Autoscaler (CA) from removing a node from the cluster. While CA automatically scales down the node pool to optimize costs when resource utilization drops, it respects specific constraints to ensure system stability and availability.
Default Behavior¶
By default, the Cluster Autoscaler periodically evaluates the cluster to identify candidates for removal^[400-devops__06-Kubernetes__k8s-ithelp__Day25__README.md].
- Frequency: This check occurs at set intervals, typically every 10 seconds^[400-devops__06-Kubernetes__k8s-ithelp__Day25__README.md].
- Threshold: A node is considered a candidate for scale-down if the sum of CPU and memory requests on that node drops below 50%^[400-devops__06-Kubernetes__k8s-ithelp__Day25__README.md].
- Constraints: The node must not have any scheduling restrictions (Pod or Node conditions) that prevent the Pods running on it from being moved elsewhere^[400-devops__06-Kubernetes__k8s-ithelp__Day25__README.md].
Protection Mechanisms¶
If the constraints preventing scale-down are not met, the Cluster Autoscaler will not terminate the node^[400-devops__06-Kubernetes__k8s-ithelp__Day25__README.md].
Policy-Based Protection¶
The Cluster Autoscaler checks for policy violations during the eviction process. It will not scale down a node if evicting the Pods would violate:
- Pod Affinity / Anti-Affinity rules
- Pod Disruption Budgets (PDB)^[400-devops__06-Kubernetes__k8s-ithelp__Day25__README.md]
Annotation-Based Protection¶
Administrators can manually protect specific nodes from being scaled down by adding a specific annotation to the Node object^[400-devops__06-Kubernetes__k8s-ithelp__Day25__README.md].
- Key:
cluster-autoscaler.kubernetes.io/scale-down-disabled - Value:
true
When this annotation is present, the Cluster Autoscaler will ignore the node during its scale-down evaluations^[400-devops__06-Kubernetes__k8s-ithelp__Day25__README.md].