|
| 1 | +// Module included in the following assembly: |
| 2 | +// |
| 3 | +// * hosted_control_planes/hcp_high_availability/hcp-backup-restore-virt.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="backup-hosted-cluster-virt_{context}"] |
| 7 | += Backing up a hosted cluster on {VirtProductName} |
| 8 | + |
| 9 | +When you back up a hosted cluster on {VirtProductName}, the hosted cluster can remain running. The backup contains the hosted control plane components and the etcd for the hosted cluster. |
| 10 | + |
| 11 | +When the hosted cluster is not running compute nodes on external infrastructure, hosted cluster workload data that is stored in persistent volume claims (PVCs) that are provisioned by KubeVirt CSI are also backed up. The backup does not contain any KubeVirt virtual machines (VMs) that are used as compute nodes. Those VMs are automatically re-created after the restore process is completed. |
| 12 | + |
| 13 | +.Procedure |
| 14 | + |
| 15 | +. Create a Velero backup resource by creating a YAML file that is similar to the following example: |
| 16 | ++ |
| 17 | +[source,yaml] |
| 18 | +---- |
| 19 | +apiVersion: velero.io/v1 |
| 20 | +kind: Backup |
| 21 | +metadata: |
| 22 | + name: hc-clusters-hosted-backup |
| 23 | + namespace: openshift-adp |
| 24 | + labels: |
| 25 | + velero.io/storage-location: default |
| 26 | +spec: |
| 27 | + includedNamespaces: <1> |
| 28 | + - clusters |
| 29 | + - clusters-hosted |
| 30 | + includedResources: |
| 31 | + - sa |
| 32 | + - role |
| 33 | + - rolebinding |
| 34 | + - deployment |
| 35 | + - statefulset |
| 36 | + - pv |
| 37 | + - pvc |
| 38 | + - bmh |
| 39 | + - configmap |
| 40 | + - infraenv |
| 41 | + - priorityclasses |
| 42 | + - pdb |
| 43 | + - hostedcluster |
| 44 | + - nodepool |
| 45 | + - secrets |
| 46 | + - hostedcontrolplane |
| 47 | + - cluster |
| 48 | + - datavolume |
| 49 | + - service |
| 50 | + - route |
| 51 | + excludedResources: [ ] |
| 52 | + labelSelector: <2> |
| 53 | + matchExpressions: |
| 54 | + - key: 'hypershift.openshift.io/is-kubevirt-rhcos' |
| 55 | + operator: 'DoesNotExist' |
| 56 | + storageLocation: default |
| 57 | + preserveNodePorts: true |
| 58 | + ttl: 4h0m0s |
| 59 | + snapshotMoveData: true <3> |
| 60 | + datamover: "velero" <4> |
| 61 | + defaultVolumesToFsBackup: false <5> |
| 62 | +---- |
| 63 | ++ |
| 64 | +<1> This field selects the namespaces from the objects to back up. Include namespaces from both the hosted cluster and the hosted control plane. In this example, `clusters` is a namespace from the hosted cluster and `clusters-hosted` is a namespace from the hosted control plane. By default, the `HostedControlPlane` namespace is `clusters-<hosted_cluster_name>`. |
| 65 | +<2> The boot image of the VMs that are used as the hosted cluster nodes are stored in large PVCs. To reduce backup time and storage size, you can filter those PVCs out of the backup by adding this label selector. |
| 66 | +<3> This field and the `datamover` field enable automatically uploading the CSI `VolumeSnapshots` to remote cloud storage. |
| 67 | +<4> This field and the `snapshotMoveData` field enable automatically uploading the CSI `VolumeSnapshots` to remote cloud storage. |
| 68 | +<5> This field indicates whether pod volume file system backup is used for all volumes by default. Set this value to `false` to back up the PVCs that you want. |
| 69 | + |
| 70 | +. Apply the changes to the YAML file by entering the following command: |
| 71 | ++ |
| 72 | +[source,terminal] |
| 73 | +---- |
| 74 | +$ oc apply -f <backup_file_name>.yaml |
| 75 | +---- |
| 76 | ++ |
| 77 | +Replace `<backup_file_name>` with the name of your file. |
| 78 | + |
| 79 | +. Monitor the backup process in the backup object status and in the Velero logs. |
| 80 | ++ |
| 81 | +** To monitor the backup object status, enter the following command: |
| 82 | ++ |
| 83 | +[source,terminal] |
| 84 | +---- |
| 85 | +$ watch "oc get backup -n openshift-adp <backup_file_name> -o jsonpath='{.status}' | jq" |
| 86 | +---- |
| 87 | ++ |
| 88 | +** To monitor the Velero logs, enter the following command: |
| 89 | ++ |
| 90 | +[source,terminal] |
| 91 | +---- |
| 92 | +$ oc logs -n openshift-adp -ldeploy=velero -f |
| 93 | +---- |
| 94 | + |
| 95 | +.Verification |
| 96 | + |
| 97 | +* When the `status.phase` field is `Completed`, the backup process is considered complete. |
0 commit comments