This document describes how to create a virtual machine (VM) from an existing backup in Google Distributed Cloud (GDC) air-gapped.
After a backup is created, you can create a restore for that backup, which
initiates the restoration of the entire VM. The value that you specify in the
New VM instance name field in the GDC console, or in the
restoredResourceName field in the API, acts as a prefix. The controller
prepends this prefix and a hyphen (-) to the original name of each backed-up
resource. For example, when you restore a backup by using the API, the
controller names the restored VM
RESTORED_RESOURCE_NAME-SOURCE_VM_NAME
and each associated disk
RESTORED_RESOURCE_NAME-SOURCE_DISK_NAME.
When a backup is restored, the entire VM is restored. After the resources are created, actual restoration of application capability is subject to the VM operating system or image.
This document is for developers in platform administrator or application operator groups that manage VM backup and restore operations. For more information, see Audiences for GDC air-gapped documentation.
Before you begin
Ensure you have an existing backup. For more information, see Create a backup plan.
Request IAM roles
To create a VM from a backup, ask your IAM Project Admin to grant you the following roles:
Virtual Machine Project Admin (
project-vm-admin): creates, gets, lists, watches, updates, patches, and deletes virtual machines and VM disks in project namespaces.Backup Creator (
backup-creator): creates, gets, lists, watches, updates, patches, and deletes manual backup requests and manual restore requests.Project Viewer (
project-viewer): gets, lists, and watches all resources within project namespaces.
Follow the steps to verify your access.
Create a restore for VMs
Restore a VM backup using the GDC console or the API.
Console
- Sign in to the GDC console.
- In the navigation menu, click Backup for Virtual Machines.
- Select a project.
- Click the Backups tab.
- In the list of backups, find the backup that you want to restore and click Restore.
In the New VM instance name field, enter a prefix for the restored VM instance name.
Optional: In the New VM instance description field, enter a description.
Enter a Name for the restore.
Click Restore.
API
Define a VirtualMachineRestoreRequest custom resource to initiate the
restore process. The virtualMachineBackup field references a
VirtualMachineBackup custom resource generated by a
VirtualMachineBackupRequest custom resource. Here's an example of a
VirtualMachineRestoreRequest custom resource:
apiVersion: virtualmachine.gdc.goog/v1
kind: VirtualMachineRestoreRequest
metadata:
name: RESTORE_REQUEST_NAME
namespace: PROJECT_NAME
spec:
virtualMachineBackup: VM_BACKUP_NAME
restoreName: RESTORE_NAME
restoredResourceName: RESTORED_RESOURCE_NAME
restoredResourceDescription: RESTORED_RESOURCE_DESCRIPTION
Replace the following:
VM_BACKUP_NAME: the name of theVirtualMachineBackupto restore from.PROJECT_NAME: the name of the GDC project.RESTORE_REQUEST_NAME: the name to give the restore request that is being initiated.RESTORE_NAME: name to give the restore that is being initiated.RESTORED_RESOURCE_NAME: the prefix for the restored VM and its associated disks. The controller prepends this prefix followed by a hyphen (-) to the original name of each backed-up resource—for example,RESTORED_RESOURCE_NAME-SOURCE_VM_NAMEfor the VM andRESTORED_RESOURCE_NAME-SOURCE_DISK_NAMEfor each associated disk. Ensure generated VM names don't exceed 53 characters and generated disk names don't exceed the 63-character Kubernetes RFC 1123 limit.RESTORED_RESOURCE_DESCRIPTION: notes for why the restore is being performed.
The result of the restore creates a new VM with the same configuration and disk state as the backup.
View a restore for VMs
View a list of restores using the GDC console:
- Sign in to the GDC console.
- In the navigation menu, click Backup for Virtual Machines.
- Select a project.
- Click the Restores tab.
- Click a restore in the list to view its details.
Delete a restore
Delete a restore by using the GDC console or kubectl.
Console
- Sign in to the GDC console.
- In the navigation menu, click Backup for Virtual Machines.
- Select a project.
- Click the Restores tab.
- In the list of restores, find the restore to delete and click Delete Restore.
- In the Restore name field, enter the name of the restore to delete.
- Click Delete Restore.
kubectl
List the existing restores:
kubectl get virtualmachinerestores.virtualmachine.gdc.goog -n PROJECT_NAMEReplace
PROJECT_NAMEwith the name of the project.In the list, find the restore that you want to delete.
Delete the restore:
kubectl delete virtualmachinerestores.virtualmachine.gdc.goog RESTORE_NAME -n PROJECT_NAMEReplace the following:
RESTORE_NAME: the name of the restore.PROJECT_NAME: the name of the project.