Run an Application Restore Task
You can quickly restore the application to the target namespace by performing an application recovery task based on existing application backup records in the following scenarios:
-
Kubernetes resources were accidentally deleted and need to be restored.
-
Application data needs to be migrated to other namespaces in the same cluster.
-
Application resources need to be migrated to namespaces in other clusters on the platform.
-
Kubernetes resources backed up in the production cluster need to be restored to the disaster recovery cluster.
TOC
Prerequisites
-
A successful application backup exists in the object storage where the cluster stores backup files.
-
If the PersistentVolume has a reclaimPolicy of Retain, delete
spec.claimRef.uidandspec.claimRef.resourceVersionon the corresponding PersistentVolume (PV) before restoring data to the bound PVC. -
For cross-cluster recovery (data migration), ensure that the target cluster and the cluster where the backup file resides can read the same backup file. This can be achieved in two ways:
-
The target cluster and the cluster where the backup file resides are connected to the same object storage.
-
Copy the required backup files to the object storage connected to the target cluster in advance.
-
-
If Backup Kubernetes resources and persistent volume claims was selected as the resource type for the application backup, ensure that the target cluster StorageClass name matches that of the source cluster. If not, configure the mapping between the source and target storage classes in Advanced Recovery Target Settings.
Procedure
-
In the left navigation bar, click Clusters > Backup and Recovery.
-
Switch to the Recovery Management tab.
-
Click Execute Application Recovery Task.
-
Configure the parameters as follows.
-
Click YAML in the upper-right corner to switch to YAML editing mode. Refer to Configuring Hooks to configure commands that run during recovery.
Caution: By default, the backup file is compared with resources in the target namespace. Only data that exists in the backup file but is missing in the namespace is restored. Resources with the same name or incremental resources (existing in the namespace but missing in the backup file) are not overwritten.
To overwrite resources with the same name that already exist in the namespace:
-
Click YAML in the upper-right corner to switch to YAML editing mode.
-
Add
existingResourcePolicy: updateunder.spec, and addpodstoexcludedResourcesas follows:excludedResources: ["pods"].
Tip: This method cannot overwrite application data in persistent volumes bound to PVCs.
-
-
Click Start.
What's next
-
Namespace Import: After cross-cluster or cross-platform migration, manually import the namespace into the corresponding project in Project Management. Otherwise, the recovered application may not be visible in the platform UI.
-
Reconfigure Fixed IP: After cross-cluster or cross-platform migration, fixed IP addresses of containers in compute components change. If necessary, manually update the Static IP Address parameter of the container group for deployments, daemon sets, and stateful sets.
Relevant operations
Try again
If the recovery task fails, retry the task.
Retrying will generate a new recovery record, and you can view the execution status of the task through the new recovery record.
Procedure
-
In the left navigation bar, click Clusters > Backup and Recovery.
-
Switch to the Recovery Management tab.
-
Click Retry on the right of the failed recovery record, and confirm.
Download the application recovery task log
Each time a recovery task is executed, a recovery record is generated. View the execution status and details (YAML) through the recovery record, and manually download the operation log of the application recovery task.
Procedure
-
In the left navigation bar, click Clusters > Backup and Recovery.
-
Switch to the Recovery Management tab.
-
Click Export Log on the right of the recovery record.