2022-03-03 11:44:45 +00:00
= Create etcd backup
2021-09-28 11:30:50 +09:00
This SOP should be followed in the following scenarios:
- When the need exists to create an etcd backup.
- When shutting a cluster down gracefully.
2022-03-03 11:44:45 +00:00
== Resources
2021-09-28 11:30:50 +09:00
- [1] https://docs.openshift.com/container-platform/4.8/backup_and_restore/backing-up-etcd.html[Creating an etcd backup]
2022-03-03 11:44:45 +00:00
== Take etcd backup
2021-09-28 11:30:50 +09:00
1. Connect to the `os-control01` node associated with the ENV.
2. Use the `oc` tool to make a debug connection to a controlplane node
2022-04-04 22:22:56 +02:00
+
2021-09-28 11:30:50 +09:00
----
oc debug node/<node_name>
----
3. Chroot to the /host directory on the containers filesystem
2022-04-04 22:22:56 +02:00
+
2021-09-28 11:30:50 +09:00
----
sh-4.2# chroot /host
----
4. Run the cluster-backup.sh script and pass in the location to save the backup to
2022-04-04 22:22:56 +02:00
+
2021-09-28 11:30:50 +09:00
----
sh-4.4# /usr/local/bin/cluster-backup.sh /home/core/assets/backup
----
5. Chown the backup files to be owned by user `core` and group `core`
2022-04-04 22:22:56 +02:00
+
2021-09-28 11:30:50 +09:00
----
chown -R core:core /home/core/assets/backup
----
6. From the admin machine, see inventory group: `ocp-ci-management`, become the Openshift service account, see the inventory hostvars for the host identified in the previous step and note the `ocp_service_account` variable.
2022-04-04 22:22:56 +02:00
+
2021-09-28 11:30:50 +09:00
----
ssh <host>
sudo su - <ocp_service_account>
----
7. Copy the files down to the `os-control01` machine.
2022-04-04 22:22:56 +02:00
+
2021-09-28 11:30:50 +09:00
----
scp -i <ssh_key> core@<node_name>:/home/core/assets/backup/* ocp_backups/
----