Persist Application PVC Data During SMCP Upgrade
Problem
Any non-SMCP components deployed on the management plane including PVC data gets lost post management plane upgrade.
Environment
Self Managed Cloud Platform (SMCP) 5.9 and Higher
Any PVC backed custom workload applications.
Cause
The SMCP Management Plane upgrade is designed in a way to take the backup of the Management Plane components and destroy the cluster and create new Management Plane cluster in required version and then restore the backup.
During the backup process, no data/volume other than Platform9 components are preserved. The custom data will be lost.
Resolution
The steps to backup the volumes associated with the required application pod's PV/PVC are mentioned below.
As an example, a busybox application's volume is being backed here by PVC. The StatefulSet yaml file associated is mentioned below:
BEFORE UPGRADE
Perform graceful shutdown of the pods, wait till they are properly removed
Identify the three busybox PVCs and match the name to the directory on disk. On each of the three nodes, move the PVC directory to the top level of
/opt
Take backup of all three PVCs and PVs. Ensure to repeat the same for the other two PVCs and PVs.
Edit all three PV backup files generated above and comment out the
claimRefsection.
Upgrade the SMCP Management Plane to the desired version.
AFTER UPGRADE
Move the PVC data on the disk, back into the original directory on each node. Repeat this step on all three nodes for respective PVC.
Re-apply the PVs and PVCs.
Start with the PVs that contains the commented out claimRef, followed by the associated PVCs.
Apply the PVC post applying PV; the PVC should show
Boundstatus. Repeat this with other PVCs & PVs.
Redeploy the application. The pods should attach to the volumes successfully and the previous data from the volumes will be utilised.
