Follow these instructions to use Dell EMC PowerProtect Data Manager 19.8 and ConfigMap to enable backup snapshot Persistent Volume Claims to bind to a user-defined storage class during backup.
This article addresses the following scenario:
- You have two storage classes defined in your Kubernetes cluster. For example:
debjeet@irv-ppdm-sdr-140:~$ kubectl get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
csi-hostpath-sc (default) hostpath.csi.k8s.io Delete Immediate true 161d
debjeet-sc hostpath.csi.k8s.io Delete Immediate true 12d
- Your application namespace uses, for example, the first storage class:
debjeet@irv-ppdm-sdr-140:~$ kubectl get pods,pvc -n exns
NAME READY STATUS RESTARTS AGE
pod/wordpress-mysql-5b697dbbfc-gfv9k 1/1 Running 0 16d
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
persistentvolumeclaim/mysql-pv-claim Bound pvc-d6df4270-dc9e-48bb-bca9-bd430cea88c6 2Gi RWO csi-hostpath-sc 16d
- When you initiate a backup job, Dell EMC PowerProtect Data Manager creates a temporary backup snapshot Persistent Volume Claims which is mounted to cProxy pod. This action moves the backup snapshot to the PowerProtect Appliance. This backup snapshot Persistent Volume Claims automatically binds to the source Persistent Volume Claims storage class.
debjeet@irv-ppdm-sdr-140:~$ kubectl get pods,pvc -n exns
NAME READY STATUS RESTARTS AGE
pod/epco-2021-06-17-11-40-05-epco-mysql-pv-claim-cproxy 1/1 Running 0 5s
pod/wordpress-mysql-5b697dbbfc-gfv9k 1/1 Running 0 17d
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
persistentvolumeclaim/mysql-pv-claim Bound pvc-d6df4270-dc9e-48bb-bca9-bd430cea88c6 2Gi RWO csi-hostpath-sc 17d
persistentvolumeclaim/pvc-epco-2021-06-17-11-40-05-mysql-pv-claim Bound pvc-4031a452-fd2b-42b1-b1a5-da4df6dc9eb0 2Gi RWO csi-hostpath-sc 6s
- You must have the temporary backup snapshot Persistent Volume Claims mounted to a different storage class. This requirement may be due to storage-class restrictions or internal policies for the source storage class.
Perform the following steps:
- Create a ConfigMap in the powerprotect namespace with the name ppdm-snapshot-storage-class-mapping using the following command:
kubectl create cm ppdm-snapshot-storage-class-mapping -n powerprotect
- Edit the ConfigMap using the following command:
kubectl edit cm ppdm-snapshot-storage-class-mapping -n powerprotect
- The editor opens. Add the data section highlighted in bold in the following ConfigMap example.
apiVersion: v1
kind: ConfigMap
data:
csi-hostpath-sc: debjeet-sc
metadata:
creationTimestamp: "2021-06-04T14:13:17Z"
name: ppdm-snapshot-storage-class-mapping
namespace: powerprotect
resourceVersion: "29682568"
selfLink: /api/v1/namespaces/powerprotect/configmaps/ppdm-snapshot-storage-class-mapping
uid: 74def0f9-207d-4ea5-a9b1-0fca688c7ea5
- Provide the mapping between the Source Storage Class Name and the Target Storage Class Name.
If you are providing multiple mappings in a single ConfigMap, the following scenarios show the unsupported and supported use cases:
- Unsupported scenario: You cannot map one storage class to two different storage classes. For example:
isilon-sc: unity-nfs
isilon-sc: vxflex-sc
- Supported scenario: You can map different storage classes to one storage class.
unity-nfs: isilon-sc
vxflex-sc: isilon-sc
- Save the ConfigMap. For the backup Persistent Volume Claim that is bound to the Source Storage Class Name listed in the ConfigMap, the Backup Snapshot Persistent Volume Claim is bound to the Target Storage Class Name listed in the ConfigMap.
Using the previous example ConfigMap, the Source Storage Class Name is csi-hostpath-sc and the Target Storage Class Name is debjeet-sc. If a Persistent Volume Claim being backed up uses storage class csi-hostpath-sc, its snapshot Persistent Volume Claim during backup will now be bound to debjeet-sc.
debjeet@irv-ppdm-sdr-140:~$ kubectl get pods,pvc -n exns
NAME READY STATUS RESTARTS AGE
pod/epco-2021-06-17-11-40-05-epco-mysql-pv-claim-cproxy 1/1 Running 0 5s
pod/wordpress-mysql-5b697dbbfc-gfv9k 1/1 Running 0 17d
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
persistentvolumeclaim/mysql-pv-claim Bound pvc-d6df4270-dc9e-48bb-bca9-bd430cea88c6 2Gi RWO csi-hostpath-sc 17d
persistentvolumeclaim/pvc-epco-2021-06-17-11-40-05-mysql-pv-claim Bound pvc-4031a452-fd2b-42b1-b1a5-da4df6dc9eb0 2Gi RWO debjeet-sc 56s