# Restoring a Kubernetes Static Provisioned Volume

You can restore a Kubernetes static provisioned volume that is protected by either namespace-level backup or application-level backup by completing the steps in each section of this page.

In Kubernetes, a static provisioned volume refers to a persistent volume (PV) that is manually created by a cluster administrator and made available for consumption by applications. Non-static provisioned volumes, on the other hand, are automatically created by the cluster when an application requests storage by creating a PVC. The cluster provisions a volume that matches the specifications mentioned in the PVC.

## Create a Persistent Volume (PV) on the Destination

Create a PV on the destination that References the PersistentVolumeClaim (PVC).

The PVC is created in the next step.

     kubectl create -f $[path_to_PV_manifest]
    apiVersion: v1
    kind: PersistentVolume
    metadata:  name: pv0006
    spec:  storageClassName: ""  capacity:    storage: 1Gi  accessModes:    - ReadWriteOnce  persistentVolumeReclaimPolicy: Retain  claimRef:    namespace: static-rst2    name: myclaim  hostPath:    path: "/mnt"

## Create a PVC on the Destination

Create the PVC, using the same name as the PVC at the source.

     kubectl create -f $[path_to_PVC_manifest] -n $[destination_namespace]
    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:  name: myclaim
    spec:  storageClassName: ""  accessModes:    - ReadWriteOnce  resources:
        requests:      storage: 1Gi

## Restore the Application Files to the Destination PVC

1. From the Command Center navigation pane, go to Protect > Kubernetes.

   The Applications tab appears.

2. On the Application groups tab, in the row for the application group that contains the content that you want to restore, click the action button , and then click Restore.

   The Select restore type page appears.

3. Click Application files.

   The Restore page appears.

4. To select a specific backup copy to restore from, do the following:

   By default, Commvault restores content from the first available, valid backup copy that it finds.

   1. In the upper-right corner of the page, click Settings.

      The Settings dialog box appears.

   2. From the MediaAgent list, select the access node that contains the backup copy.

   3. From the Source list, select the backup copy.

   4. Click Save.

5. Click Restore.

   The Restore options dialog box appears.

6. On the Volume tab, click Out of place.

7. For Destination cluster, select the cluster to restore the content to.

   You can select any Kubernetes cluster that is added to Commvault.

8. From the Access node list, select the access node to perform the restore.

   For optimal performance, select an access node that has low latency to the Kubernetes cluster and the backup copy.

9. In the Volume box, enter the volume to restore the content to.

10. In the Path box, enter the destination path relative to the PVC mount point.

    If the destination volume is mounted on the pod at /var/lib/www and you want to restore the files to /var/lib/www/html, then enter /html.

11. To delete and overwrite existing data, move the Unconditionally overwrite if it already exists toggle key to the right, and then click Yes in the confirmation dialog box.

    If any data matching the restore data exists in the destination, Commvault deletes the existing data before starting the restore process.

12. Click Submit.

## Restore the Full Application to the Destination

Restore the full application to the destination, with the overwrite setting disabled.

1. From the Command Center navigation pane, go to Protect > Kubernetes.

   The Applications tab appears.

2. On the Application groups tab, in the row for the application group that you want to restore, click the action button , and then click Restore.

   The Select restore type page appears.

3. Click Full application.

   The Restore page appears.

4. Select the applications to restore.

5. To select a specific backup copy to restore from, do the following:

   By default, Commvault restores content from the first available, valid backup copy that it finds.

   1. In the upper-right corner of the page, click Settings.

      The Settings dialog box appears.

   2. From the MediaAgent list, select the access node that contains the backup copy.

   3. From the Source list, select the backup copy.

   4. Click Save.

6. Click Restore.

   The Restore options dialog box appears.

7. For Type, select Out of place.

8. For Destination cluster, select the cluster to restore the content to.

   You can select any Kubernetes cluster that is added to Commvault.

9. From the Access node list, select the access node to perform the restore.

   For optimal performance, select an access node that has low latency to the Kubernetes cluster and the backup copy.

10. In the Application name box, enter a name for the restored application.

11. Specify the namespace to restore the application to:

    - To select an existing namespace, from the Namespace list, select the namespace.

    - To create a namespace, move the Enter namespace manually toggle key to the right, and then enter a name for the namespace.

12. From the Storage class list, select the StorageClass to provision PersistentVolumes from.

    If you intend to back up the restored application with Commvault, select a StorageClass that has a CSI provisioner, an attacher, and a snapshotter.

13. Leave the Unconditionally overwrite if it exists toggle key un-selected.

14. Click Submit.

## Verify Whether the App Is Restored Correctly

Verify whether the app is restored correctly.

     kubectl exec -it $[Pod_name] -n $[destination_namespace] -- bash
    ls $[mount_path_for_application]

×

Loading...