sigs.k8s.io/cluster-api@v1.7.1/docs/book/src/tasks/automated-machine-management/autoscaling.md (about) 1 # Using the Cluster Autoscaler 2 3 This section applies only to worker Machines. Cluster Autoscaler is a tool that automatically adjusts the size of the Kubernetes cluster based 4 on the utilization of Pods and Nodes in your cluster. For more general information about the 5 Cluster Autoscaler, please see the 6 [project documentation](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler). 7 8 The following instructions are a reproduction of the Cluster API provider specific documentation 9 from the [Autoscaler project documentation](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler/cloudprovider/clusterapi). 10 11 {{#embed-github repo:"kubernetes/autoscaler" path:"cluster-autoscaler/cloudprovider/clusterapi/README.md" }} 12 13 <aside class="note warning"> 14 15 <h1>Defaulting of the MachineDeployment, MachineSet replicas field</h1> 16 17 Please note that the MachineDeployment and MachineSet replicas field has special defaulting logic to provide a smooth integration with the autoscaler. 18 The replica field is defaulted based on the autoscaler min and max size annotations.The goal is to pick a default value which is inside 19 the (min size, max size) range so the autoscaler can take control of the replicase field. 20 21 The defaulting logic is as follows: 22 * if the autoscaler min size and max size annotations are set: 23 * if it's a new MachineDeployment or MachineSet, use min size 24 * if the replicas field of the old MachineDeployment or MachineSet is < min size, use min size 25 * if the replicas field of the old MachineDeployment or MachineSet is > max size, use max size 26 * if the replicas field of the old MachineDeployment or MachineSet is in the (min size, max size) range, keep the value from the oldMD or oldMS 27 * otherwise, use 1 28 </aside>