Back up VMs

This page describes how to back up virtual machines (VMs) while adhering to GDC backup and restore principles. It also contains instructions on how to view a list of VM backups, and delete existing VM backups.

Before you begin

Before backing up VMs, you must already have a backup repository and backup plan.

Manually back up VMs

A manual backup must reference an existing backup plan for the backup configuration.

To get the permissions you need to create a manual backup, ask your Project IAM Admin to grant you the following roles:

  • Project VM Admin (project-vm-admin)
  • Backup Creator (backup-creator)
  • Project Viewer (project-viewer)

Back up VMs using either the GDC console or the API.

Console

  1. Sign into the GDC console.
  2. In the navigation menu, click Backup for Virtual Machines.
  3. Select a project.
  4. Click the Backups tab.
  5. Click Create a backup.
  6. In the Source VM instance field, select the VM that you want to back up.
  7. Enter a Name for the backup.
  8. In the Backup plan field, select the backup plan for which you want to to create a backup.
  9. Click Create.

API

Issue a virtual machine backup request to initiate a backup:

apiVersion: virtualmachine.gdc.goog/v1
kind: VirtualMachineBackupRequest
metadata:
  name: BACKUP_REQUEST_NAME
spec:
  virtualMachineBackupPlanTemplate: VM_BACKUP_PLAN
  virtualMachine: VM_NAME
  virtualMachineBackupName: VM_BACKUP_NAME

Replace the following:

  • BACKUP_REQUEST_NAME: name to give the backup request that is being initiated.
  • VM_BACKUP_PLAN: the name of the VirtualMachineBackupPlanTemplate resource to use for configuration of the backup.
  • VM_NAME: the name of the VM to back up.
  • VM_BACKUP_NAME: the name of the backup to create.

View VM backups

View a list of VM backups using the GDC console or kubectl.

Console

  1. Sign into the GDC console.
  2. In the navigation menu, click Backup for Virtual Machines.
  3. Select a project.
  4. Click the Backups tab.
  5. Click a backup in the list to view its details.

kubectl

View a VM backup by listing the backups and viewing their details.

  1. List the existing backups:

    kubectl get virtualmachinebackups.virtualmachine.gdc.goog -n PROJECT_NAME
    

    Replace PROJECT_NAME with the name of the project.

  2. In the list, find the backup that you want to view.

  3. View the backup details:

    kubectl describe virtualmachinebackup.virtualmachine.gdc.goog VM_BACKUP_NAME -n PROJECT_NAME
    

    Replace the following:

    • VM_BACKUP_NAME: the name of the backup.
    • PROJECT_NAME: the name of the project.

Delete a VM backup

Delete VM backups by using the GDC console or kubectl.

Console

  1. Sign in to the GDC console.
  2. In the navigation menu, click Backup for Virtual Machines.
  3. Select a project.
  4. Click the Backups tab.
  5. In the list of backups, find the backup to delete and click Delete Backup.
  6. In the Backup name field, enter the name of the backup to delete.
  7. Click Delete Backup.

kubectl

Delete a VM backup using kubectl.

  1. List the existing VM backups:

    kubectl get virtualmachinebackups.virtualmachine.gdc.goog -n PROJECT_NAME
    

    Replace PROJECT_NAME with the name of the project.

  2. In the list, find the backup that you want to delete.

  3. Issue a VirtualMachineDeleteBackupRequest to delete the backup:

    apiVersion: virtualmachine.gdc.goog/v1
    kind: VirtualMachineDeleteBackupRequest
    metadata:
      name: DELETE_BACKUP_REQUEST_NAME
      namespace: PROJECT_NAME
    spec:
      virtualMachineBackupRef:
        name: VM_BACKUP_NAME
    

    Replace the following:

    • DELETE_BACKUP_REQUEST_NAME: the name to give the VirtualMachineDeleteBackupRequest that is being initiated.
    • VM_BACKUP_NAME: the name of the backup to delete.
    • PROJECT_NAME: the name of the project.