|
| 1 | +:_mod-docs-content-type: ASSEMBLY |
| 2 | +[id="cloud-experts-getting-started-autoscaling"] |
| 3 | += Tutorial: Autoscaling |
| 4 | +include::_attributes/attributes-openshift-dedicated.adoc[] |
| 5 | +:context: cloud-experts-getting-started-autoscaling |
| 6 | + |
| 7 | +toc::[] |
| 8 | + |
| 9 | +//rosaworkshop.io content metadata |
| 10 | +//Brought into ROSA product docs 2024-01-04 |
| 11 | + |
| 12 | +The xref:../../rosa_cluster_admin/rosa_nodes/rosa-nodes-about-autoscaling-nodes.adoc#rosa-nodes-about-autoscaling-nodes[cluster autoscaler] adds or removes worker nodes from a cluster based on pod resources. |
| 13 | + |
| 14 | +The cluster autoscaler increases the size of the cluster when: |
| 15 | + |
| 16 | +* Pods fail to schedule on the current nodes due to insufficient resources. |
| 17 | +* Another node is necessary to meet deployment needs. |
| 18 | +
|
| 19 | +The cluster autoscaler does not increase the cluster resources beyond the limits that you specify. |
| 20 | + |
| 21 | +The cluster autoscaler decreases the size of the cluster when: |
| 22 | + |
| 23 | +* Some nodes are consistently not needed for a significant period. For example, when a node has low resource use and all of its important pods can fit on other nodes. |
| 24 | +
|
| 25 | +== Enabling autoscaling for an existing machine pool using the CLI |
| 26 | + |
| 27 | +[NOTE] |
| 28 | +==== |
| 29 | +Cluster autoscaling can be enabled at cluster creation and when creating a new machine pool by using the `--enable-autoscaling` option. |
| 30 | +==== |
| 31 | + |
| 32 | +. Autoscaling is set based on machine pool availability. To find out which machine pools are available for autoscaling, run the following command: |
| 33 | ++ |
| 34 | +[source,terminal] |
| 35 | +---- |
| 36 | +$ rosa list machinepools -c <cluster-name> |
| 37 | +---- |
| 38 | ++ |
| 39 | +.Example output |
| 40 | ++ |
| 41 | +[source,terminal] |
| 42 | +---- |
| 43 | +ID AUTOSCALING REPLICAS INSTANCE TYPE LABELS TAINTS AVAILABILITY ZONES |
| 44 | +Default No 2 m5.xlarge us-east-1a |
| 45 | +---- |
| 46 | + |
| 47 | +. Run the following command to add autoscaling to an available machine pool: |
| 48 | ++ |
| 49 | +[source,terminal] |
| 50 | +---- |
| 51 | +$ rosa edit machinepool -c <cluster-name> --enable-autoscaling <machinepool-name> --min-replicas=<num> --max-replicas=<num> |
| 52 | +---- |
| 53 | ++ |
| 54 | +.Example input |
| 55 | ++ |
| 56 | +[source,terminal] |
| 57 | +---- |
| 58 | +$ rosa edit machinepool -c my-rosa-cluster --enable-autoscaling Default --min-replicas=2 --max-replicas=4 |
| 59 | +---- |
| 60 | ++ |
| 61 | +The above command creates an autoscaler for the worker nodes that scales between 2 and 4 nodes depending on the resources. |
| 62 | + |
| 63 | +== Enabling autoscaling for an existing machine pool using the UI |
| 64 | + |
| 65 | +[NOTE] |
| 66 | +==== |
| 67 | +Cluster autoscaling can be enabled at cluster creation by checking the *Enable autoscaling* checkbox when creating machine pools. |
| 68 | +==== |
| 69 | + |
| 70 | +. Go to the *Machine pools* tab and click the three dots in the right.. |
| 71 | +. Click *Scale*, then *Enable autoscaling*. |
| 72 | +. Run the following command to confirm that autoscaling was added: |
| 73 | ++ |
| 74 | +[source,terminal] |
| 75 | +---- |
| 76 | +$ rosa list machinepools -c <cluster-name> |
| 77 | +---- |
| 78 | ++ |
| 79 | +.Example output |
| 80 | ++ |
| 81 | +[source,terminal] |
| 82 | +---- |
| 83 | +ID AUTOSCALING REPLICAS INSTANCE TYPE LABELS TAINTS AVAILABILITY ZONES |
| 84 | +Default Yes 2-4 m5.xlarge us-east-1a |
| 85 | +---- |
0 commit comments