This document describes how to create scheduled 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.
This document is for developers in platform administrator or application operator groups that manage VM backup operations. For more information, see Audiences for GDC air-gapped documentation.
Before you begin
To create VM backup plans, you must have the following:
Request IAM permissions
To manage the lifecycle of VM backup resources, including creating, viewing, and
deleting backup and restore plans within user clusters, ask your Organization IAM
Admin to grant you the
Organization Backup Admin (organization-backup-admin) role. This role lets
you configure and execute VM data protection strategies.
Create a backup plan template for VMs
To plan your backups, create a VirtualMachineBackupPlanTemplate custom
resource. Here's an example of a VirtualMachineBackupPlanTemplate:
apiVersion: virtualmachine.gdc.goog/v1
kind: VirtualMachineBackupPlanTemplate
metadata:
name: BACKUP_TEMPLATE_NAME
namespace: PROJECT_NAME
spec:
backupRepository: "BACKUP_REPOSITORY_NAME"
Replace the following:
BACKUP_TEMPLATE_NAME: the name of backup plan template.PROJECT_NAME: the name of the project to create the template within.BACKUP_REPOSITORY_NAME: the name of the repository created in the previous section.
Create a defined backup plan for VMs
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
selectedVirtualMachinesandselectedVirtualMachineDisks. - 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 VM backup plan template.VM_NAME: Specify the VM names as a list in theselectedVirtualMachinesfield. 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 VM disks to be 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 VM backup plan template.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.
View a backup plan
View a backup plan using the GDC console or kubectl.
Console
View a list of backup plans using the GDC console.
- Sign into the GDC console.
- In the navigation menu, click Backup for Virtual Machines > Backup plans.
- Select a project.
- Click a backup plan in the list to view its details.
kubectl
View a backup plan by listing the backup plans and viewing
their details using kubectl.
List the existing backup plans:
kubectl get backupplans.backup.gdc.goog -n PROJECT_NAMEIn the list, find the backup plan that you want to view.
View the backup plan details:
kubectl describe backupplans.backup.gdc.goog BACKUP_PLAN_NAME -n PROJECT_NAMEReplace the following:
BACKUP_PLAN_NAME: the name of the backup plan.PROJECT_NAME: the name of the project.