You can use Velero to backup specific CNF persisent volumes in the same workload cluster.

Prerequisites

Install and Configure Velero Add-On for the Workload Clusters.

Procedure

  1. Log in to the VMware Telco Cloud Automation web interface.
  2. Navigate to Infrastructure > Virtual Infrastructure.
  3. Open the web terminal by clicking Options (three dots) corresponding to the workload cluster you want to back up and then selecting Open Terminal.
  4. On the web terminal, check the service health of Velero by running the following command:
    # kubectl get pod -n velero
    # kubectl get bsl -n velero
  5. Back up CNF's specific persisent volumes matching the label selector.
    1. firstly label the pvc and pv that to be backed up
    # kubectl -n <cnf-namespaces> label pvc <example-pvc> <key>=<value>
    # kubectl label pv <example-pv> <key>=<value>
    2. backup the k8s resources matching the label selector
    # velero backup create <example-pv-backup> --selector <key>=<value>

    Also you can use "--include-resources" flag to back up all persistent volumes under some namespaces:

    # velero backup create <example-pv-backup> --include-resources pvc,pv --include-namespaces <cnf-namespaces-by-comma>

    For more resource filtering method, please refer to velero resource filtering doc.

    The backup command above uses velero-plugin-for-vsphere as default to back up the Persistent Volumes created with vSphere CSI storage class. If there exists Persistent Volumes created with nfs-client storage class to be backed up, change default PV backup plugin to Restic with velero cli flag "--default-volumes-to-fs-backup". This will use Restic to back up all kinds of Persistent Volumes, including the ones created with vSphere CSI storage class.

    1. firstly label the pvc/pv. For nfs pv, please also label the pod which is mounting this pv
    # kubectl -n <cnf-namespaces> label pvc <example-pvc> <key>=<value>
    # kubectl label pv <example-pv> <key>=<value>
    # kubectl -n <cnf-namespaces> label pod <example-pod> <key>=<value>
    2. backup the k8s resources matching the label selector
    # velero backup create <example-pv-backup> --selector <key>=<value> --default-volumes-to-fs-backup

    You can also choose to back up all the persistent volumes using Restic plugin under some namespaces:

    # velero backup create <example-pv-backup> --include-resources pvc,pv,pod --include-namespaces <cnf-namespaces-by-comma> --default-volumes-to-fs-backup
  6. Check backup status and related CRs and wait until the processes are "Completed".
    # velero backup get // check the backup status
    Check the status of uploads CR if using velero-plugin-for-vsphere to back up PV data.
    # kubectl get uploads -n velero // get the upload-name 
    # kubectl get uploads <upload-name> -o yaml // check the uploads status in yaml output

    If you annotate pods and use restic to back up PV, check the status of podvolumebackups CR.

    # kubectl get podvolumebackups -n velero // get the podvolumebackup-name 
    # kubectl get podvolumebackups <podvolumebackup-name> -o yaml // check the podvolumebackups status in yaml output

What to do next

Restore Specific CNF Persistent Volume