|
| 1 | +:_mod-docs-content-type: ASSEMBLY |
| 2 | +[id="cloud-experts-getting-started-managing-worker-nodes"] |
| 3 | += Tutorial: Managing worker nodes |
| 4 | +include::_attributes/attributes-openshift-dedicated.adoc[] |
| 5 | +:context: cloud-experts-getting-started-managing-worker-nodes |
| 6 | + |
| 7 | +toc::[] |
| 8 | + |
| 9 | +//rosaworkshop.io content metadata |
| 10 | +//Brought into ROSA product docs 2023-11-30 |
| 11 | + |
| 12 | +In {product-title} (ROSA), changing aspects of your worker nodes is performed through the use of machine pools. A machine pool allows users to manage many machines as a single entity. Every ROSA cluster has a default machine pool that is created when the cluster is created. For more information, see the xref:../../rosa_cluster_admin/rosa_nodes/rosa-nodes-machinepools-about.adoc#rosa-nodes-machinepools-about[machine pool] documentation. |
| 13 | + |
| 14 | + |
| 15 | +== Creating a machine pool |
| 16 | +You can create a machine pool with either the command line interface (CLI) or the user interface (UI). |
| 17 | + |
| 18 | +=== Creating a machine pool with the CLI |
| 19 | +. Run the following command: |
| 20 | ++ |
| 21 | +[source,terminal] |
| 22 | +---- |
| 23 | +rosa create machinepool --cluster=<cluster-name> --name=<machinepool-name> --replicas=<number-nodes> |
| 24 | +---- |
| 25 | ++ |
| 26 | +.Example input |
| 27 | ++ |
| 28 | +[source,terminal] |
| 29 | +---- |
| 30 | + $ rosa create machinepool --cluster=my-rosa-cluster --name=new-mp |
| 31 | + --replicas=2 |
| 32 | +---- |
| 33 | ++ |
| 34 | +.Example output |
| 35 | ++ |
| 36 | +[source,terminal] |
| 37 | +---- |
| 38 | +I: Machine pool 'new-mp' created successfully on cluster 'my-rosa-cluster' |
| 39 | +I: To view all machine pools, run 'rosa list machinepools -c my-rosa-cluster' |
| 40 | +---- |
| 41 | + |
| 42 | +. *Optional:* Add node labels or taints to specific nodes in a new machine pool by running the following command: |
| 43 | ++ |
| 44 | +[source,terminal] |
| 45 | +---- |
| 46 | +rosa create machinepool --cluster=<cluster-name> --name=<machinepool-name> --replicas=<number-nodes> --labels=`<key=pair>` |
| 47 | +---- |
| 48 | ++ |
| 49 | +.Example input |
| 50 | ++ |
| 51 | +[source,terminal] |
| 52 | +---- |
| 53 | +$ rosa create machinepool --cluster=my-rosa-cluster --name=db-nodes-mp --replicas=2 --labels='app=db','tier=backend' |
| 54 | +---- |
| 55 | ++ |
| 56 | +.Example output |
| 57 | ++ |
| 58 | +[source,terminal] |
| 59 | +---- |
| 60 | +I: Machine pool 'db-nodes-mp' created successfully on cluster 'my-rosa-cluster' |
| 61 | +---- |
| 62 | ++ |
| 63 | +This creates an additional 2 nodes that can be managed as a unit and also assigns them the labels shown. |
| 64 | + |
| 65 | +. Run the following command to confirm machine pool creation and the assigned labels: |
| 66 | ++ |
| 67 | +[source,terminal] |
| 68 | +---- |
| 69 | +rosa list machinepools --cluster=<cluster-name> |
| 70 | +---- |
| 71 | ++ |
| 72 | +.Example output |
| 73 | ++ |
| 74 | +[source,terminal] |
| 75 | +---- |
| 76 | +ID AUTOSCALING REPLICAS INSTANCE TYPE LABELS TAINTS AVAILABILITY ZONES |
| 77 | +Default No 2 m5.xlarge us-east-1a |
| 78 | +---- |
| 79 | + |
| 80 | +=== Creating a machine pool with the UI |
| 81 | +. Log in to the link:https://console.redhat.com/openshift[Red Hat console] and click your cluster. |
| 82 | ++ |
| 83 | +image::cloud-experts-getting-started-managing-ocm-cluster.png[] |
| 84 | + |
| 85 | +. Click *Machine pools*. |
| 86 | ++ |
| 87 | +image:cloud-experts-getting-started-managing-mp-ocm.png[] |
| 88 | + |
| 89 | +. Click *Add machine pool*. |
| 90 | + |
| 91 | +. Enter the desired configuration. |
| 92 | ++ |
| 93 | +[TIP] |
| 94 | +==== |
| 95 | +You can also and expand the *Edit node labels and taints* section to add node labels and taints to the nodes in the machine pool. |
| 96 | +==== |
| 97 | ++ |
| 98 | +image::cloud-experts-getting-started-managing-mp-nlt.png[] |
| 99 | + |
| 100 | +. You will see the new machine pool you created. |
| 101 | ++ |
| 102 | +image::cloud-experts-getting-started-managing-mp-fromui.png[] |
| 103 | + |
| 104 | +== Scaling worker nodes |
| 105 | + |
| 106 | +Edit a machine pool to scale the number of worker nodes in that specific machine pool. You can use either the CLI or the UI to scale worker nodes. |
| 107 | + |
| 108 | +=== Scaling worker nodes using the CLI |
| 109 | + |
| 110 | +. Run the following command to see the default machine pool that is created with each cluster: |
| 111 | ++ |
| 112 | +[source,terminal] |
| 113 | +---- |
| 114 | +rosa list machinepools --cluster=<cluster-name> |
| 115 | +---- |
| 116 | ++ |
| 117 | +.Example output |
| 118 | ++ |
| 119 | +[source,terminal] |
| 120 | +---- |
| 121 | +ID AUTOSCALING REPLICAS INSTANCE TYPE LABELS TAINTS AVAILABILITY ZONES |
| 122 | +Default No 2 m5.xlarge us-east-1a |
| 123 | +---- |
| 124 | + |
| 125 | +. To scale the default machine pool out to a different number of nodes, run the following command: |
| 126 | ++ |
| 127 | +[source,terminal] |
| 128 | +---- |
| 129 | +rosa edit machinepool --cluster=<cluster-name> --replicas=<number-nodes> <machinepool-name> |
| 130 | +---- |
| 131 | ++ |
| 132 | +.Example input |
| 133 | ++ |
| 134 | +[source,terminal] |
| 135 | +---- |
| 136 | +rosa edit machinepool --cluster=my-rosa-cluster --replicas 3 Default |
| 137 | +---- |
| 138 | + |
| 139 | +. Run the following command to confirm that the machine pool has scaled: |
| 140 | ++ |
| 141 | +[source,terminal] |
| 142 | +---- |
| 143 | +rosa describe cluster --cluster=<cluster-name> | grep Compute |
| 144 | +---- |
| 145 | ++ |
| 146 | +.Example input |
| 147 | ++ |
| 148 | +[source,terminal] |
| 149 | +---- |
| 150 | +$ rosa describe cluster --cluster=my-rosa-cluster | grep Compute |
| 151 | +---- |
| 152 | ++ |
| 153 | +.Example output |
| 154 | ++ |
| 155 | +[source,terminal] |
| 156 | +---- |
| 157 | +- Compute: 3 (m5.xlarge) |
| 158 | +---- |
| 159 | + |
| 160 | +=== Scaling worker nodes using the UI |
| 161 | + |
| 162 | +. Click the three dots to the right of the machine pool you want to edit. |
| 163 | +. Click *Edit*. |
| 164 | +. Enter the desired number of nodes, and click *Save*. |
| 165 | +. Confirm that the cluster has scaled by selecting the cluster, clicking the *Overview* tab, and scrolling to *Compute listing*. The compute listing should equal the scaled nodes. For example, 3/3. |
| 166 | ++ |
| 167 | +image::cloud-experts-getting-started-managing-ocm-nodes.png[] |
| 168 | + |
| 169 | +=== Adding node labels |
| 170 | + |
| 171 | +. Use the following command to add node labels: |
| 172 | ++ |
| 173 | +[source,terminal] |
| 174 | +---- |
| 175 | +rosa edit machinepool --cluster=<cluster-name> --replicas=<number-nodes> --labels='key=value' <machinepool-name> |
| 176 | +---- |
| 177 | ++ |
| 178 | +.Example input |
| 179 | ++ |
| 180 | +[source,terminal] |
| 181 | +---- |
| 182 | +rosa edit machinepool --cluster=my-rosa-cluster --replicas=2 --labels 'foo=bar','baz=one' new-mp |
| 183 | +---- |
| 184 | ++ |
| 185 | +This adds 2 labels to the new machine pool. |
| 186 | + |
| 187 | +[IMPORTANT] |
| 188 | +==== |
| 189 | +This command replaces all machine pool configurations with the newly defined configuration. If you want to add another label *and* keep the old label, you must state both the new and preexisting the label. Otherwise the command will replace all preexisting labels with the one you wanted to add. Similarly, if you want to delete a label, run the command and state the ones you want, excluding the one you want to delete. |
| 190 | +==== |
| 191 | + |
| 192 | +== Mixing node types |
| 193 | + |
| 194 | +You can also mix different worker node machine types in the same cluster by using new machine pools. You cannot change the node type of a machine pool once it is created, but you can create a new machine pool with different nodes by adding the `--instance-type` flag. |
| 195 | + |
| 196 | +. For example, to change the database nodes to a different node type, run the following command: |
| 197 | ++ |
| 198 | +[source,terminal] |
| 199 | +---- |
| 200 | +rosa create machinepool --cluster=<cluster-name> --name=<mp-name> --replicas=<number-nodes> --labels='<key=pair>' --instance-type=<type> |
| 201 | +---- |
| 202 | ++ |
| 203 | +.Example input |
| 204 | ++ |
| 205 | +[source,terminal] |
| 206 | +---- |
| 207 | +rosa create machinepool --cluster=my-rosa-cluster --name=db-nodes-large-mp --replicas=2 --labels='app=db','tier=backend' --instance-type=m5.2xlarge |
| 208 | +---- |
| 209 | + |
| 210 | +. To see all the xref:../../rosa_architecture/rosa_policy_service_definition/rosa-service-definition.adoc#rosa-sdpolicy-aws-instance-types_rosa-service-definition[instance types available], run the following command: |
| 211 | ++ |
| 212 | +[source,terminal] |
| 213 | +---- |
| 214 | +rosa list instance-types |
| 215 | +---- |
| 216 | + |
| 217 | +. To make step-by-step changes, use the `--interactive` flag: |
| 218 | ++ |
| 219 | +[source,terminal] |
| 220 | +---- |
| 221 | +rosa create machinepool -c <cluster-name> --interactive |
| 222 | +---- |
| 223 | ++ |
| 224 | +image::cloud-experts-getting-started-managing-mp-interactive.png[] |
| 225 | + |
| 226 | +. Run the following command to list the machine pools and see the new, larger instance type: |
| 227 | ++ |
| 228 | +[source,terminal] |
| 229 | +---- |
| 230 | +rosa list machinepools -c <cluster-name> |
| 231 | +---- |
| 232 | ++ |
| 233 | +image::cloud-experts-getting-started-managing-large-mp.png[] |
0 commit comments