This page describes how to create scoped backup plans that back up virtual machine (VM) workloads on a defined schedule in Google Distributed Cloud (GDC) air-gapped.
Backup plans provide the configuration and location for backups. A backup plan
contains a backup configuration including the source VM and the selection of
which VM to back up. Backup plans define a regular schedule for which backups of
VMs occur. Every VM-based backup plan references the target VM or VM disk
resources to be backed up using a label selector defined in a
ProtectedApplication
resource.
Before you begin
To create VM backup plans, you must have the following:
- An existing
VirtualMachineBackupPlanTemplate
. For more information, see Create a backup plan. - The necessary identity and access role. For more information, see Prepare roles and permissions.
Create a backup plan
To create VM backups on a defined schedule that have a scope specified, you must create a VirtualMachineBackupPlan
resource using the API. This resource specifies the scope of the VM backup and the cron schedule that defines the frequency of backup creation.
Set the scope of the VM backup plan in two ways:
- Use a list: Specify the virtual machines or virtual machine disks to back up in the form of a list. These backup targets are listed in the fields
selectedVirtualMachines
andselectedVirtualMachineDisks
. - Use a label: Provide a label that selects all virtual machines or virtual machine disks that contain that label value. Any matching VMs are backed up by this backup plan.
Create a VM backup plan using a list
To create a VM backup plan using the list method, specify the backup targets in the selectedVirtualMachines
and selectedVirtualMachineDisks
fields:
apiVersion: virtualmachine.gdc.goog/v1
kind: VirtualMachineBackupPlan
metadata:
name: BACKUP_PLAN_NAME
namespace: BACKUP_PLAN_NAMESPACE
spec:
virtualMachineBackupPlanTemplate: BACKUP_TEMPLATE_NAME
backupConfig:
backupScope:
selectedVirtualMachines:
- resourceName: VM_NAME
selectedVirtualMachineDisks:
- resourceName: VM_DISK_NAME
volumeStrategy: VOLUME_STRATEGY
backupSchedule:
cronSchedule: CRON_SCHEDULE
paused: false
Replace the following:
BACKUP_PLAN_NAME
: the name of the backup plan.BACKUP_PLAN_NAMESPACE
: the namespace containing the backup plan.BACKUP_TEMPLATE_NAME
: the virtual machine backup plan template that points to the relevant backup repository created in Create a backup plan.VM_NAME
: Specify the VM names as a list in theselectedVirtualMachines
field. This list of VMs is backed up by this virtual machine backup plan. If more than one VM is specified, the list must be in the following format:selectedVirtualMachines: - resourceName: "virtualmachine" - resourceName: "virtualmachine-2" ... - resourceName: "virtualmachine-n"
VM_DISK_NAME
: The list of VM disks that is backed up by this virtual machine backup plan. If more than one VM disk is specified, the list must be in the following format:selectedVirtualMachineDisks: - resourceName: "disk-1 - resourceName: "disk-2" ... - resourceName: "disk-n"
VOLUME_STRATEGY
: The type of volume backup to perform. For example,LocalSnapshotOnly
.CRON_SCHEDULE
: the cron expression that defines the chosen backup schedule. For example, a cron value of0 */12 * * *
creates a backup every 12 hours.
Create a VM backup plan using a label
To create a VM backup plan using the label method, specify a label in vmResourceLabelSelector
field that matches the target VMs you want to back up:
apiVersion: virtualmachine.gdc.goog/v1
kind: VirtualMachineBackupPlan
metadata:
name: BACKUP_PLAN_NAME
namespace: BACKUP_PLAN_NAMESPACE
spec:
virtualMachineBackupPlanTemplate: BACKUP_TEMPLATE_NAME
backupConfig:
backupScope:
vmResourceLabelSelector:
KEY: VALUE
volumeStrategy: VOLUME_STRATEGY
backupSchedule:
cronSchedule: CRON_SCHEDULE
paused: false
Replace the following:
BACKUP_PLAN_NAME
: the name of the backup plan.BACKUP_PLAN_NAMESPACE
: the namespace containing the backup plan.BACKUP_TEMPLATE_NAME
: the virtual machine backup plan template that points to the relevant backup repository created in Create a backup plan.KEY: VALUE
: the label selector that matches the given labels to any VMs that contain that label. Any matching VMs found in the same namespace are backed up by this backup plan. This object must be in the formatkeys:string, values:string
.VOLUME_STRATEGY
: The type of volume backup to perform. For example,LocalSnapshotOnly
.CRON_SCHEDULE
: the cron expression that defines the chosen backup schedule. For example, a cron value of0 */12 * * *
creates a backup every 12 hours.