Skip to content

Latest commit

 

History

History
133 lines (104 loc) · 4.98 KB

10_backup_restore.adoc

File metadata and controls

133 lines (104 loc) · 4.98 KB

Backup and Restore

Introduction

There are multiple options for backup and restore of virtual machines with OpenShift Virtualization.

Additionally, many storage partners offer the ability to protect virtual machine disks using their native technology. Be sure to check with your storage and backup vendor(s) to determine compatibility with OpenShift Virtualization.

This lab will use OADP to perform a virtual machine backup and restore.

Goals
  • Review Operator

  • Perform a backup

  • Perform a restore

Review Operator

  1. Navigate in the left menu to OperatorsInstalled Operators and ensure that All projects is selected. Select OADP Operator.

    00 Left Menu
  2. Review the Provided APIs available. In this module, the Backup and Restore functions will be used.

    01 Overview
  3. Navigate to the tab DataProtectionApplication. This object represents the configuration of the deployed OADP instance.

    02 DPA
  4. Select oadp-dpa and review the YAML definition

    03 OADP YAML

    Notice that OADP has been configured by adding the kubevirt plugin and it has been configured to use the internal object storage bucket provided by Red Hat Storage.

    In a production environment you would want to backup to an external storage system, however, in this lab, we are using internal object storage for the sake of convenience.

Create a backup

You will perform a backup of the VM fedora02. The selection of the objects to be backed up is defined by the labels app and vm.kubevirt.io/name. This includes the VM definition, disks, and additional objects being used by the virtual machine such as config maps and secrets.

  1. Go back one screen to the main Operator page by clicking on the Operator name

  2. Navigate to the Backup tab and press Create Backup

    04 Backup Tab
  3. Switch to the YAML view and replace the content with the following one:

    apiVersion: velero.io/v1
    kind: Backup
    metadata:
      name: backup-fedora02
      labels:
        velero.io/storage-location: default
      namespace: openshift-adp
    spec:
      hooks: {}
      orLabelSelectors:
      - matchLabels:
          app: fedora02
      - matchLabels:
          vm.kubevirt.io/name: fedora02
      includedNamespaces:
      - vmexamples
      storageLocation: oadp-dpa-1
      ttl: 720h0m0s

    Notice that the content of this YAML indicates that any object with the labels app: fedora02 in the namespace vmexamples will be backed up to the location specified in the DataProtectionApplication configuration.

    Important
    If you do not have the fedora02 VM, change the label selectors in the YAML above to match a virtual machine in your environment.
  4. Wait till the Status column changes to Completed. This indicates that the virtual machine has been successfully backed up.

    05 Backup Completed

Restore a backup

  1. Navigate to VirtualizationVirtualMachines and delete the VM fedora02.

  2. Go back to OperatorsInstalled Operators and select OADP Operator.

  3. Switch to the Restore tab and press Create Restore

    06 Restore Tab
  4. Switch to the YAML view and replace the content with the following one:

    apiVersion: velero.io/v1
    kind: Restore
    metadata:
      name: restore-fedora02
      namespace: openshift-adp
    spec:
      backupName: backup-fedora02
      includedResources: []
      excludedResources:
      - nodes
      - events
      - events.events.k8s.io
      - backups.velero.io
      - restores.velero.io
      restorePVs: true
  5. Wait till the Status column changes to Completed.

    07 Restore Completed
  6. Navigate back to VirtualizationVirtual Machines and ensure the fedora02 was restored.

    08 VM Restored

Summary

Protecting virtual machines is a critical aspect of a virtualization platform. OpenShift Virtualization provides multiple methods that enable native protection, for example using OADP, or allowing storage and backup partners to integrate their offerings. If you have questions about how to protect virtual machines, please don’t hesitate to ask the proctors for the workshop or reach out to your vendor to determine their compatibility with OpenShift Virtualization.