After a backup is created, you can create a restore for that backup, which initiates the restoration of some portion of the contents of that backup into a target cluster. This target cluster might be different from the cluster where the backup was originally created.
When a backup is restored, the Kubernetes resources are recreated in the target cluster. After the resources are created, actual restoration of workload functionality is subject to the regular cluster reconciliation process. For example, pods are scheduled to nodes and then started on those nodes.
Create a restore
To get the permissions that you need to create a Restore
, ask your Project IAM
Admin to grant you the Backup Creator (backup-creator
) role. Manually restore a backup using the GDC console or the API.
Console
- Sign in to the GDC console.
- In the navigation menu, click Backup for Clusters.
- Select a project.
- Click the Backups tab.
- In the list of backups, find the backup to restore and click Restore.
- Choose a restore plan from the list of plans that apply to this backup.
- Enter a name and an optional description for the restore.
- Click Restore.
API
Create a ManualRestoreRequest
custom resource to perform restores from
existing RestorePlans
. Specify the Backup
that you want to restore, the
name of the Restore
that you want to create, and the RestorePlan
that
matches the BackupPlan
of the Backup
. Here's an example of a
ManualRestoreRequest
:
apiVersion: backup.gdc.goog/v1
kind: ManualRestoreRequest
metadata:
name: manualrestorerequest-sample
namespace: default
spec:
restoreName: "test-manual-restore"
restorePlanName: "restoreplan-sample"
backupName: "temp-backup"
description: "restores test clusters"
This example includes the following values:
Value | Description |
---|---|
backupName |
The name of the Backup to restore. |
description |
User-provided description of why the Restore is being
created. This description is inherited by the created
Restore . |
restoreName |
The name of the Restore to create. |
restorePlanName |
The name of the RestorePlan that this restore uses. |
After initiating a ManualRestoreRequest
, a Restore
custom resource is
generated.
Restore from an imported backup
You can restore a backup from another backup that was completed in a different cluster. For example, if the original cluster is inactive or you want to clone an existing cluster.
First, create a backup repository in the target cluster that points to the
storage location used by the source cluster. If the repository is
actively being used by the source cluster in ReadWrite
mode, you must specify the ImportPolicy
as ReadOnly
. For more information, see
Backup repository import policies.
After the backup repository is created and the backups are successfully imported, the repository backup resources are present in the target cluster. You can then schedule a restore in the target cluster by referencing an imported backup.
View a restore
View a list of restores using the GDC console or kubectl
.
Console
- Sign in to the GDC console.
- In the navigation menu, click Backup for Clusters.
- Click Select project to select an organization or project depending on your role:
- Backup Admin: Select an organization to see all of the restores in an organization or select a project to see all of the restores in a project.
- Backup Creator: Select a project to see all of the restores in a project.
- Click the Restores tab.
- Click a restore in the list to view its details.
kubectl
View the status of a Restore
in the default namespace:
kubectl get restores
Here's an example of the output:
NAME STATE
restore-sample Succeeded
View Restores
in all namespaces:
kubectl get restores -A
View Restores
in a specific namespace:
kubectl get restores -n NAMESPACE
Replace NAMESPACE
with the namespace containing the restores.
Delete a restore
Unlike backups, deleting a restore does not require issuing a request. Restores are deleted by deleting the resource directly from the Kubernetes API server. This action also cleans up any associated restore artifacts from object storage.
Delete a restore:
kubectl delete restores RESTORE_NAME
Replace RESTORE_NAME
with the name of the restore.