Overview

This document provides an overview of virtual machine (VM) backup and restore operations in Google Distributed Cloud (GDC) air-gapped environments. It outlines the different methodologies and the distinction between GDC console and API capabilities.

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.

GDC supports the ability to back up and restore VM-based and container-based workloads. GDC VM backup supports the backup and restoration of multiple VM or VM disk snapshots. Backups are managed through backup plans, which let you schedule regular backups or create backups manually. You can restore entire VMs, creating a new instance with the same configuration and disk state as the backup, or restore disk snapshots.

GDC backup for VMs offer the following features:

  • Support for different VM instance configurations and sizes.
  • Customer data stored in primary storage in the form of Kubernetes persistent volumes and VM disk images.
  • Local snapshots for VM disks.

Backup and restoration process

You can back up and restore your Distributed Cloud data in the GDC console or the API.

To back up and restore VM and container workloads, follow these general steps:

  1. Create a backup repository.
  2. Create a backup plan that references the backup repository:
  3. Back up VMs or back up disks in the form of snapshots.
  4. Restore VMs or snapshots based on the backups.

Backup repository overview

Before you create backups or snapshots, you must create a backup repository. A backup repository contains configuration information, for example, the bucket name, region, and storage endpoint. The backup repository name is provided as an input parameter when you create a VM backup plan.

For more information, see Create a backup repository.

VM backup resources

The VM backup system in GDC consists of these key user-managed custom resources:

  • BackupRepository: Defines the storage location for your backup data. You can manage this custom resource through the API and the GDC console.
  • VirtualMachineBackupPlanTemplate: Defines the backup repository that a backup plan uses. You can manage this custom resource through the API and the GDC console.
  • VirtualMachineBackupPlan: Defines a scheduled, recurring backup strategy. This custom resource specifies the backup schedule, the scope of VMs to back up, and the retention policy for the backups. You can manage this custom resource only through the API.
  • VirtualMachineBackupRequest: Starts an on-demand backup. You can use this custom resource to create one-off manual backups or to manually initiate a backup defined in a VirtualMachineBackupPlan custom resource. You can manage this custom resource through the API and the GDC console, but you can trigger a backup plan only by using the API.
  • VirtualMachineRestoreRequest: Restores a VM from a backup. You can manage this custom resource through the API and the GDC console.

User-managed and controller-managed VM backup resources

When you set up VM backups in your project namespace, you create high-level virtualmachine.gdc.goog/v1 custom resources. The VM backup controller then automatically creates supporting backup.gdc.goog/v1 and gkebackup.gke.io/v1 custom resources in the same namespace.

The following table describes these user-managed and controller-managed custom resources:

Resource role API group and kind Name in project namespace How to identify Purpose and management
User-managed VM backup plan and template

virtualmachine.gdc.goog/v1

Kinds: VirtualMachineBackupPlan, VirtualMachineBackupPlanTemplate

VM_BACKUP_PLAN

VM_BACKUP_PLAN_TEMPLATE

Standard user-managed custom resources in the virtualmachine.gdc.goog/v1 API group

You create these custom resources to define the backup schedule (cronSchedule), paused state, and target VMs, VM disks, or label selectors (selectedVirtualMachines, selectedVirtualMachineDisks, or vmResourceLabelSelector). You can also set the maxConcurrency limit to a value from 1 to 7 (the default is 2 in the v2 organization architecture). In the v1 organization architecture, the controller doesn't propagate the maxConcurrency field.

Specify the target backup repository in the spec.backupRepository field of a VirtualMachineBackupPlanTemplate custom resource and reference that template in the spec.virtualMachineBackupPlanTemplate field of your plan. The controller populates the internal spec.backupConfig.backupRepository field from the template during reconciliation.

Controller-managed backing BackupPlan custom resources (for a VM backup plan)

backup.gdc.goog/v1

Kind: BackupPlan

VM_BACKUP_PLAN-cb (configuration backing plan, status.configBackupPlan)

VM_BACKUP_PLAN-vb (volume backing plan, status.volumeBackupPlan)

VM_BACKUP_PLAN (status.backupPlan in the v1 organization architecture)

Label: virtualmachine.gdc.goog/virtual-machine-backup-plan: VM_BACKUP_PLAN (or "true" in the v1 organization architecture)

Annotation: VMBackupPlan: VM_BACKUP_PLAN

The VM backup controller creates two backing BackupPlan custom resources for each VirtualMachineBackupPlan custom resource. The -cb plan backs up VM configuration, and the -vb plan (with includeVolumeData: true) backs up VM volume data. In the v1 organization architecture, the controller creates a single backing BackupPlan custom resource with the same name as your VirtualMachineBackupPlan custom resource.

The controller keeps these backing plans configured with paused: true and cronSchedule: "1 * * * *". The controller triggers scheduled backups from the cronSchedule field on your plan and enforces your maxConcurrency limit. Don't unpause, edit, or delete these custom resources.

Controller-managed backing BackupPlan custom resource (for a template)

backup.gdc.goog/v1

Kind: BackupPlan

VM_BACKUP_PLAN_TEMPLATE (same name as your VirtualMachineBackupPlanTemplate custom resource) Label: virtualmachine.gdc.goog/vmbpt-repository: BACKUP_REPOSITORY_NAME The VM backup controller creates this custom resource with deactivated: true and paused: true. GDC uses this custom resource to persist template metadata to the backup repository's object storage for import and disaster recovery. Don't edit or delete this custom resource.
Controller-managed ProtectedApplication custom resource

gkebackup.gke.io/v1

Kind: ProtectedApplication

VM_BACKUP_PLAN-VM_OR_DISK_NAME Annotation: VMBackupPlan: VM_BACKUP_PLAN The VM backup controller creates this custom resource for each protected VM or disk to define which resources each backup includes. Don't edit or delete this custom resource.

This table includes the following placeholder values:

  • VM_BACKUP_PLAN: the name of your VirtualMachineBackupPlan custom resource
  • VM_BACKUP_PLAN_TEMPLATE: the name of your VirtualMachineBackupPlanTemplate custom resource
  • BACKUP_REPOSITORY_NAME: the name of your BackupRepository custom resource
  • VM_OR_DISK_NAME: the name of the protected VM or VM disk

Follow these guidelines so that your changes don't conflict with the VM backup controller:

  • Edit only user-managed resources: Update only VirtualMachineBackupPlan (virtualmachine.gdc.goog/v1) custom resources; VirtualMachineBackupPlanTemplate specifications are immutable after creation. Don't unpause or edit the controller-managed backing BackupPlan.backup.gdc.goog custom resources (VM_BACKUP_PLAN-cb and VM_BACKUP_PLAN-vb, or VM_BACKUP_PLAN in the v1 organization architecture). If you unpause a backing plan, the controller either resets it or starts unexpected backups that skip VM preparation and exceed maxConcurrency limits. Don't manually create a BackupPlan.backup.gdc.goog custom resource named VM_BACKUP_PLAN-cb or VM_BACKUP_PLAN-vb (or VM_BACKUP_PLAN in the v1 organization architecture). Creating a duplicate blocks the VM backup controller with an error similar to backup plan VM_BACKUP_PLAN-cb does not have annotation VMBackupPlan: VM_BACKUP_PLAN.
  • Pause schedules safely: To pause scheduled backups during maintenance, set the spec.backupSchedule.paused field to true on your VirtualMachineBackupPlan custom resource instead of deleting the plan.
  • Run on-demand backups with backup requests: To start an on-demand backup, don't edit the cronSchedule field. Instead, create a VirtualMachineBackupRequest custom resource (virtualmachine.gdc.goog/v1).
  • Configure backup repositories: Specify the target backup repository in the spec.backupRepository field of a VirtualMachineBackupPlanTemplate custom resource and reference that template in the spec.virtualMachineBackupPlanTemplate field of your VirtualMachineBackupPlan custom resource. The spec.backupConfig.backupRepository field is for internal use only, and the controller populates it from the template during reconciliation.
  • Keep controller finalizers and labels: Don't remove controller finalizers or controller-managed scope labels. Controller finalizers include virtualmachine.gdc.goog/vmbp-pa-finalizer and virtualmachine.gdc.goog/vmbp-finalizer on VirtualMachineBackupPlan custom resources, and virtualmachine.gdc.goog/vmbpt-finalizer on VirtualMachineBackupPlanTemplate custom resources. Controller-managed scope labels include bpvms/VM_NAME: IncludedInBackupScope, bpdisks/DISK_NAME: IncludedInBackupScope, and backupplans/VM_BACKUP_PLAN: IncludedInBackupScope. In these labels, VM_NAME is the VM name, and DISK_NAME is the VM disk name. Removing these finalizers or labels can prevent GDC from selecting backup resources or cleanly deleting controller-managed ProtectedApplication and backing BackupPlan custom resources.

Plan backups

You can create a backup plan and perform backup and restore functions using either the API or the GDC console. All backup methods are supported through the API, while on-demand, manual backups are the only backup types the GDC console supports.

Scheduled backups (API only)

This method involves the creation of a VirtualMachineBackupPlan resource, which references a VirtualMachineBackupPlanTemplate. You can define a recurring backup schedule, the scope of VMs to include, and a retention policy.

For more details, see Create a scheduled backup plan to back up and restore VMs.

On-demand backups (GDC console and API)

This method uses a VirtualMachineBackupRequest resource that directly references a VirtualMachineBackupPlanTemplate. You can perform a one-time backup of a specific VM or VM disk. For more details, see Create a manual backup.

Manual trigger of a defined backup plan (GDC console and API)

This method uses a VirtualMachineBackupRequest resource that references an existing VirtualMachineBackupPlan. It immediately triggers a backup of all VMs defined in the scope of the referenced plan. This backup method is useful for taking an ad hoc backup of a group of VMs that are part of a scheduled plan.

For more information, see Create a manual backup.

Restore backups

You can restore VM workloads or disk snapshots for backups you create manually or as part of the scheduled backup plans: