Skip to content

Commit 472e97f

Browse files
Merge pull request #70452 from kowen-rh/ocpbugs-12446
OCPBUGS#12446: Update docs to move etcd to a different disk
2 parents e397af0 + 66127d0 commit 472e97f

File tree

1 file changed

+66
-45
lines changed

1 file changed

+66
-45
lines changed

modules/move-etcd-different-disk.adoc

Lines changed: 66 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,36 @@
88

99
You can move etcd from a shared disk to a separate disk to prevent or resolve performance issues.
1010

11-
.Prerequisites
12-
13-
* The `MachineConfigPool` must match `metadata.labels[machineconfiguration.openshift.io/role]`. This applies to a controller, worker, or a custom pool.
14-
* The node's auxiliary storage device, such as `/dev/sdb`, must match the sdb. Change this reference in all places in the file.
11+
The Machine Config Operator (MCO) is responsible for mounting a secondary disk for {product-title} {product-version} container storage.
1512

1613
[NOTE]
1714
====
1815
This procedure does not move parts of the root file system, such as `/var/`, to another disk or partition on an installed node.
1916
====
2017

21-
The Machine Config Operator (MCO) is responsible for mounting a secondary disk for an {product-title} {product-version} container storage.
18+
.Prerequisites
2219

23-
Use the following steps to move etcd to a different device:
20+
* You have installed the {oc-first}.
21+
* You have access to the cluster with `cluster-admin` privileges.
22+
* The `MachineConfigPool` must match `metadata.labels[machineconfiguration.openshift.io/role]`. This applies to a controller, worker, or a custom pool.
2423
2524
.Procedure
26-
. Create a `machineconfig` YAML file named `etcd-mc.yml` and add the following information:
25+
26+
. Attach the new disk to the cluster and verify that the disk is detected in the node by using the `lsblk` command in a debug shell:
27+
+
28+
[source,terminal]
29+
----
30+
$ oc debug node/<node_name>
31+
----
32+
+
33+
[source,terminal]
34+
----
35+
# lsblk
36+
----
37+
+
38+
Note the device name of the new disk reported by the `lsblk` command.
39+
40+
. Create a `MachineConfig` YAML file named `etcd-mc.yml` with contents such as the following, replacing instances of `<new_disk_name>` with the noted device name:
2741
+
2842
[source,yaml]
2943
----
@@ -41,31 +55,31 @@ spec:
4155
units:
4256
- contents: |
4357
[Unit]
44-
Description=Make File System on /dev/sdb
58+
Description=Make File System on /dev/<new_disk_name>
4559
DefaultDependencies=no
46-
BindsTo=dev-sdb.device
47-
After=dev-sdb.device var.mount
48-
Before=systemd-fsck@dev-sdb.service
60+
BindsTo=dev-<new_disk_name>.device
61+
After=dev-<new_disk_name>.device var.mount
62+
Before=systemd-fsck@dev-<new_disk_name>.service
4963

5064
[Service]
5165
Type=oneshot
5266
RemainAfterExit=yes
53-
ExecStart=/usr/lib/systemd/systemd-makefs xfs /dev/sdb
67+
ExecStart=/usr/lib/systemd/systemd-makefs xfs /dev/<new_disk_name>
5468
TimeoutSec=0
5569

5670
[Install]
5771
WantedBy=var-lib-containers.mount
5872
enabled: true
59-
name: systemd-mkfs@dev-sdb.service
73+
name: systemd-mkfs@dev-<new_disk_name>.service
6074
- contents: |
6175
[Unit]
62-
Description=Mount /dev/sdb to /var/lib/etcd
76+
Description=Mount /dev/<new_disk_name> to /var/lib/etcd
6377
Before=local-fs.target
64-
Requires=systemd-mkfs@dev-sdb.service
65-
After=systemd-mkfs@dev-sdb.service var.mount
78+
Requires=systemd-mkfs@dev-<new_disk_name>.service
79+
After=systemd-mkfs@dev-<new_disk_name>.service var.mount
6680

6781
[Mount]
68-
What=/dev/sdb
82+
What=/dev/<new_disk_name>
6983
Where=/var/lib/etcd
7084
Type=xfs
7185
Options=defaults,prjquota
@@ -111,42 +125,29 @@ spec:
111125
WantedBy=multi-user.target graphical.target
112126
enabled: true
113127
name: restorecon-var-lib-etcd.service
114-
115128
----
116129
117-
. Create the machine configuration by entering the following commands:
130+
. Log in to the cluster as a user with `cluster-admin` privileges and create the machine configuration:
118131
+
119132
[source,terminal]
120133
----
121-
$ oc login -u ${ADMIN} -p ${ADMINPASSWORD} ${API}
122-
... output omitted ...
134+
$ oc login -u <username> -p <password>
123135
----
124136
+
125137
[source,terminal]
126138
----
127139
$ oc create -f etcd-mc.yml
128-
machineconfig.machineconfiguration.openshift.io/98-var-lib-etcd created
129-
----
130-
+
131-
[source,terminal]
132-
----
133-
$ oc login -u ${ADMIN} -p ${ADMINPASSWORD} ${API}
134-
[... output omitted ...]
135-
----
136-
+
137-
[source,terminal]
138-
----
139-
$ oc create -f etcd-mc.yml machineconfig.machineconfiguration.openshift.io/98-var-lib-etcd created
140140
----
141141
+
142142
The nodes are updated and rebooted. After the reboot completes, the following events occur:
143143
+
144-
* An XFS file system is created on the specified disk.
145-
* The disk mounts to `/var/lib/etc`.
146-
* The content from `/sysroot/ostree/deploy/rhcos/var/lib/etcd` syncs to `/var/lib/etcd`.
147-
* A restore of `SELinux` labels is forced for `/var/lib/etcd`.
148-
* The old content is not removed.
149-
. After the nodes are on a separate disk, update the machine configuration file, `etcd-mc.yml` with the following information:
144+
* An XFS file system is created on the specified disk.
145+
* The disk mounts to `/var/lib/etcd`.
146+
* The content from `/sysroot/ostree/deploy/rhcos/var/lib/etcd` syncs to `/var/lib/etcd`.
147+
* A restore of `SELinux` labels is forced for `/var/lib/etcd`.
148+
* The old content is not removed.
149+
150+
. After the nodes are on a separate disk, update the `etcd-mc.yml` file with contents such as the following, replacing instances of `<new_disk_name>` with the noted device name:
150151
+
151152
[source,yaml]
152153
----
@@ -164,13 +165,13 @@ spec:
164165
units:
165166
- contents: |
166167
[Unit]
167-
Description=Mount /dev/sdb to /var/lib/etcd
168+
Description=Mount /dev/<new_disk_name> to /var/lib/etcd
168169
Before=local-fs.target
169-
Requires=systemd-mkfs@dev-sdb.service
170-
After=systemd-mkfs@dev-sdb.service var.mount
170+
Requires=systemd-mkfs@dev-<new_disk_name>.service
171+
After=systemd-mkfs@dev-<new_disk_name>.service var.mount
171172

172173
[Mount]
173-
What=/dev/sdb
174+
What=/dev/<new_disk_name>
174175
Where=/var/lib/etcd
175176
Type=xfs
176177
Options=defaults,prjquota
@@ -180,11 +181,31 @@ spec:
180181
enabled: true
181182
name: var-lib-etcd.mount
182183
----
183-
. Apply the modified version that removes the logic for creating and syncing the device by entering the following command:
184+
185+
. Apply the modified version that removes the logic for creating and syncing the device to prevent the nodes from rebooting:
184186
+
185187
[source,terminal]
186188
----
187189
$ oc replace -f etcd-mc.yml
188190
----
191+
192+
.Verification steps
193+
194+
* Run the `grep <new_disk_name> /proc/mounts` command in a debug shell for the node to ensure that the disk mounted:
189195
+
190-
The previous step prevents the nodes from rebooting.
196+
[source,terminal]
197+
----
198+
$ oc debug node/<node_name>
199+
----
200+
+
201+
[source,terminal]
202+
----
203+
# grep <new_disk_name> /proc/mounts
204+
----
205+
+
206+
.Example output
207+
+
208+
[source,terminal]
209+
----
210+
/dev/nvme1n1 /var/lib/etcd xfs rw,seclabel,relatime,attr2,inode64,logbufs=8,logbsize=32k,prjquota 0 0
211+
----

0 commit comments

Comments
 (0)