Skip to content

Commit 29d9591

Browse files
authored
Merge pull request #70199 from jeana-redhat/OSDOCS-9322-modifying-compute-machine-set
OSDOCS-9322: Rewriting the steps to modify a compute machine set
2 parents 3296b08 + c138e60 commit 29d9591

File tree

2 files changed

+96
-45
lines changed

2 files changed

+96
-45
lines changed

machine_management/modifying-machineset.adoc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,5 @@ include::modules/machineset-modifying.adoc[leveloffset=+1]
1818
[role="_additional-resources"]
1919
.Additional resources
2020
* xref:../machine_management/deleting-machine.adoc#machine-lifecycle-hook-deletion_deleting-machine[Lifecycle hooks for the machine deletion phase]
21-
22-
[role="_additional-resources"]
23-
.Additional resources
2421
* xref:../machine_management/manually-scaling-machineset.adoc#machineset-manually-scaling_manually-scaling-machineset[Scaling a compute machine set manually]
2522
* xref:../nodes/scheduling/nodes-scheduler-about.adoc#nodes-scheduler-about[Controlling pod placement using the scheduler]

modules/machineset-modifying.adoc

Lines changed: 96 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,91 +5,145 @@
55

66
:_mod-docs-content-type: PROCEDURE
77
[id="machineset-modifying_{context}"]
8-
= Modifying a compute machine set
8+
= Modifying a compute machine set by using the CLI
99

10-
To make changes to a compute machine set, edit the `MachineSet` YAML. Then, remove all machines associated with the compute machine set by deleting each machine or scaling down the compute machine set to `0` replicas. Then, scale the replicas back to the desired number. Changes you make to a compute machine set do not affect existing machines.
10+
When you modify a compute machine set, your changes only apply to compute machines that are created after you save the updated `MachineSet` custom resource (CR).
11+
The changes do not affect existing machines.
12+
You can replace the existing machines with new ones that reflect the updated configuration by scaling the compute machine set.
1113

1214
If you need to scale a compute machine set without making other changes, you do not need to delete the machines.
1315

1416
[NOTE]
1517
====
16-
By default, the {product-title} router pods are deployed on workers. Because the router is required to access some cluster resources, including the web console, do not scale the compute machine set to `0` unless you first relocate the router pods.
18+
By default, the {product-title} router pods are deployed on compute machines.
19+
Because the router is required to access some cluster resources, including the web console, do not scale the compute machine set to `0` unless you first relocate the router pods.
1720
====
1821

1922
.Prerequisites
2023

21-
* Install an {product-title} cluster and the `oc` command line.
22-
* Log in to `oc` as a user with `cluster-admin` permission.
24+
* Your {product-title} cluster uses the Machine API.
25+
26+
* You are logged in to the cluster as an administrator by using the {oc-first}.
2327
2428
.Procedure
2529

2630
. Edit the compute machine set by running the following command:
2731
+
2832
[source,terminal]
2933
----
30-
$ oc edit machineset <machineset> -n openshift-machine-api
34+
$ oc edit machineset <machine_set_name> -n openshift-machine-api
3135
----
3236

33-
. Scale down the compute machine set to `0` by running one of the following commands:
37+
. Note the value of the `spec.replicas` field, as you need it when scaling the machine set to apply the changes.
38+
+
39+
[source,yaml]
40+
----
41+
apiVersion: machine.openshift.io/v1beta1
42+
kind: MachineSet
43+
metadata:
44+
name: <machine_set_name>
45+
namespace: openshift-machine-api
46+
spec:
47+
replicas: 2 # <1>
48+
# ...
49+
----
50+
<1> The examples in this procedure show a compute machine set that has a `replicas` value of `2`.
51+
52+
. Update the compute machine set CR with the configuration options that you want and save your changes.
53+
54+
. List the machines that are managed by the updated compute machine set by running the following command:
3455
+
3556
[source,terminal]
3657
----
37-
$ oc scale --replicas=0 machineset <machineset> -n openshift-machine-api
58+
$ oc get -n openshift-machine-api machines -l machine.openshift.io/cluster-api-machineset=<machine_set_name>
3859
----
3960
+
40-
Or:
61+
.Example output
62+
[source,text]
63+
----
64+
NAME PHASE TYPE REGION ZONE AGE
65+
<machine_name_original_1> Running m6i.xlarge us-west-1 us-west-1a 4h
66+
<machine_name_original_2> Running m6i.xlarge us-west-1 us-west-1a 4h
67+
----
68+
69+
. For each machine that is managed by the updated compute machine set, set the `delete` annotation by running the following command:
4170
+
4271
[source,terminal]
4372
----
44-
$ oc edit machineset <machineset> -n openshift-machine-api
73+
$ oc annotate machine/<machine_name_original_1> \
74+
-n openshift-machine-api \
75+
machine.openshift.io/delete-machine="true"
4576
----
77+
78+
. Scale the compute machine set to twice the number of replicas by running the following command:
4679
+
47-
[TIP]
48-
====
49-
You can alternatively apply the following YAML to scale the compute machine set:
80+
[source,terminal]
81+
----
82+
$ oc scale --replicas=4 \// <1>
83+
machineset <machine_set_name> \
84+
-n openshift-machine-api
85+
----
86+
<1> The original example value of `2` is doubled to `4`.
5087

51-
[source,yaml]
88+
. List the machines that are managed by the updated compute machine set by running the following command:
89+
+
90+
[source,terminal]
5291
----
53-
apiVersion: machine.openshift.io/v1beta1
54-
kind: MachineSet
55-
metadata:
56-
name: <machineset>
57-
namespace: openshift-machine-api
58-
spec:
59-
replicas: 0
92+
$ oc get -n openshift-machine-api machines -l machine.openshift.io/cluster-api-machineset=<machine_set_name>
93+
----
94+
+
95+
.Example output
96+
[source,text]
97+
----
98+
NAME PHASE TYPE REGION ZONE AGE
99+
<machine_name_original_1> Running m6i.xlarge us-west-1 us-west-1a 4h
100+
<machine_name_original_2> Running m6i.xlarge us-west-1 us-west-1a 4h
101+
<machine_name_updated_1> Provisioned m6i.xlarge us-west-1 us-west-1a 55s
102+
<machine_name_updated_2> Provisioning m6i.xlarge us-west-1 us-west-1a 55s
60103
----
61-
====
62104
+
63-
Wait for the machines to be removed.
105+
When the new machines are in the `Running` phase, you can scale the compute machine set to the original number of replicas.
64106

65-
. Scale up the compute machine set as needed by running one of the following commands:
107+
. Scale the compute machine set to the original number of replicas by running the following command:
66108
+
67109
[source,terminal]
68110
----
69-
$ oc scale --replicas=2 machineset <machineset> -n openshift-machine-api
111+
$ oc scale --replicas=2 \// <1>
112+
machineset <machine_set_name> \
113+
-n openshift-machine-api
70114
----
71-
+
72-
Or:
115+
<1> The original example value of `2`.
116+
117+
.Verification
118+
119+
* To verify that the compute machines without the updated configuration are deleted, list the machines that are managed by the updated compute machine set by running the following command:
73120
+
74121
[source,terminal]
75122
----
76-
$ oc edit machineset <machineset> -n openshift-machine-api
123+
$ oc get -n openshift-machine-api machines -l machine.openshift.io/cluster-api-machineset=<machine_set_name>
77124
----
78125
+
79-
[TIP]
80-
====
81-
You can alternatively apply the following YAML to scale the compute machine set:
82-
83-
[source,yaml]
126+
.Example output while deletion is in progress
127+
[source,text]
84128
----
85-
apiVersion: machine.openshift.io/v1beta1
86-
kind: MachineSet
87-
metadata:
88-
name: <machineset>
89-
namespace: openshift-machine-api
90-
spec:
91-
replicas: 2
129+
NAME PHASE TYPE REGION ZONE AGE
130+
<machine_name_original_1> Deleting m6i.xlarge us-west-1 us-west-1a 4h
131+
<machine_name_original_2> Deleting m6i.xlarge us-west-1 us-west-1a 4h
132+
<machine_name_updated_1> Running m6i.xlarge us-west-1 us-west-1a 5m41s
133+
<machine_name_updated_2> Running m6i.xlarge us-west-1 us-west-1a 5m41s
92134
----
93-
====
94135
+
95-
Wait for the machines to start. The new machines contain changes you made to the compute machine set.
136+
.Example output when deletion is complete
137+
[source,text]
138+
----
139+
NAME PHASE TYPE REGION ZONE AGE
140+
<machine_name_updated_1> Running m6i.xlarge us-west-1 us-west-1a 6m30s
141+
<machine_name_updated_2> Running m6i.xlarge us-west-1 us-west-1a 6m30s
142+
----
143+
144+
* To verify that a machine created by the updated machine set has the correct configuration, examine the relevant fields in the CR for one of the new machines by running the following command:
145+
+
146+
[source,terminal]
147+
----
148+
$ oc describe machine <machine_name_updated_1> -n openshift-machine-api
149+
----

0 commit comments

Comments
 (0)