CephFS VolumeGroupSnapshot in OpenShift Data Foundation 4.18 - Technology preview

Updated

Note: This feature is Dev-preview for ODF 4.17 and is Technology preview for ODF 4.18

This article provides instructions for setting up a OpenShift 4.17 cluster to support the VolumeGroupSnapshot feature, which is currently in alpha and disabled by default. Enabling VolumeGroupSnapshot feature requires turning on the TechPreviewNoUpgrade feature gates in OpenShift. The guide outlines the steps needed to enable the TechPreviewNoUpgrade feature gate for VolumeGroupSnapshot.

The article covers the process of configuring the feature gate in OpenShift, Additionally, it includes YAML manifests for creating and testing VolumeGroupSnapshot functionality, such as creating a VolumeGroupSnapshot and restoring a VolumeGroupSnapshot.

Perform the following steps to enable volume group snapshot feature:

NOTE: This is also part of the standard OpenShift documentation

  1. Edit the cluster featuregate CR.
$ oc edit featuregate cluster
  1. Set the TechPreviewNoUpgrade value for the featureSet.
spec:
  featureSet: TechPreviewNoUpgrade
  1. Check if the volumegroupsnapshot featuregate is enabled.
$ oc get -oyaml featuregate cluster
...
status:
  featureGates:
  - disabled:
    ...
    enabled:
    ...
    - name: VolumeGroupSnapshot    
  1. Check if the volumegroup CRDs are installed.
$ oc get crd |grep volumegroupsnapshot
volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io    2024-10-10T10:48:51Z
volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io   2024-10-10T10:48:52Z
volumegroupsnapshots.groupsnapshot.storage.k8s.io          2024-10-10T10:48:52Z

Wait until all 3 volume group CRDs are installed.

  1. Restart the Rook operator pod to enable the volume group snapshot feature in OpenShift Data Foundation.
 $ oc delete po -l app=rook-ceph-operator -nopenshift-storage

Creating a volume group snapshot:

  1. Locate (or create) the PVCs that you want to include in the volume group snapshot:
oc get pvc

Example output:

NAME        STATUS    VOLUME                                     CAPACITY   ACCESSMODES   AGE
pvc-0       Bound     pvc-a42d7ea2-e3df-11ed-b5ea-0242ac120002   1Gi        RWO           48s
pvc-1       Bound     pvc-a42d81b8-e3df-11ed-b5ea-0242ac120002   1Gi        RWO           48S

This example uses two PVCs.

  1. Label the PVCs to belong to a snapshot group:

a. Label PVC pvc-0 by running the following command:

oc label pvc pvc-0 group=myGroup

Example output:

oc label pvc pvc-0 group=myGroup

b. Label PVC pvc-1 by running the following command:

oc label pvc pvc-1 group=myGroup

Example output:

persistentvolumeclaim/pvc-1 labeled

In this example, you are labeling PVC "pvc-0" and "pvc-1" to belong to group "myGroup".

  1. Create a VolumeGroupSnapshot object to specify your volume group snapshot:

a. Create a VolumeGroupSnapshot object YAML file with the following example file:

Example VolumeGroupSnapshot YAML file:

apiVersion: groupsnapshot.storage.k8s.io/v1beta1
kind: VolumeGroupSnapshot 
metadata:
  name: <volume-group-snapshot-name> 
  namespace: <namespace> 
spec:
  volumeGroupSnapshotClassName: <volume-group-snapshot-class-name> 
  source:
    selector:
      matchLabels:
        group: myGroup 
  • The VolumeGroupSnapshot object requests creation of a volume group snapshot for multiple PVCs.
  • <volume-group-snapshot-name> is the name of the volume group snapshot.
  • <namespace> is the namespace for the volume group snapshot.
  • <volume-group-snapshot-class-name> is the VolumeGroupSnapshotClass name. This object is created by the administrator and describes how volume group snapshots should be created.
  • myGroup is the name of the label used to group the desired PVCs for the snapshot. In this example, it is "myGroup".

b. Create the VolumeGroupSnapshot object by running the following command:

oc create -f <volume-group-snapshot-filename>.yaml

Results

Individual volume snapshots are created according to how many PVCs were specified as part of the volume group snapshot.

These individual volume snapshots are named with the following format: <hash of VolumeGroupSnaphotContentUUID+volumeHandle>:

Example individual volume snapshot

apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
  name: snapshot-4dc1c53a29538b36e85003503a4bcac5dbde4cff59e81f1e3bb80b6c18c3fd03
  namespace: default
  ownerReferences:
  - apiVersion: groupsnapshot.storage.k8s.io/v1beta1
    kind: VolumeGroupSnapshot
    name: my-groupsnapshot
    uid: ba2d60c5-5082-4279-80c2-daa85f0af354
  resourceVersion: "124503"
  uid: c0137282-f161-4e86-92c1-c41d36c6d04c
spec:
  source:
    persistentVolumeClaimName:pvc-1
status:
  volumeGroupSnapshotName: volume-group-snapshot-name

In the preceding example, two individual volume snapshots are created as part of the volume group snapshot.

snapshot-4dc1c53a29538b36e85003503a4bcac5dbde4cff59e81f1e3bb80b6c18c3fd03
snapshot-fbfe59eff570171765df664280910c3bf1a4d56e233a5364cd8cb0152a35965b

Restoring a VolumeGroupSnapshot

You can use the VolumeGroupSnapshot custom resource definition (CRD) content to restore the existing volumes to a previous state.

To restore existing volumes, you can request a new persistent volume claim (PVC) to be created from a VolumeSnapshot object that is part of a VolumeGroupSnapshot. This triggers provisioning of a new volume that is populated with data from the specified snapshot. Repeat this process until all volumes are created from all the snapshots that are part of a volume group snapshot.

  1. Specify a VolumeSnapshot data source from a volume group snapshot for a PVC as shown in the following example:

Example restore PVC YAML file:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: <pvc-restore-name> 
  namespace: <namespace> 
spec:
  storageClassName: ocs-storagecluster-cephfs
  dataSource:
    name: snapshot-fbfe59eff570171765df664280910c3bf1a4d56e233a5364cd8cb0152a35965b 
    kind: VolumeSnapshot 
    apiGroup: snapshot.storage.k8s.io 
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  • <pvc-restore-name> is then name of the restore PVC.
  • <namespace> is the name of the namespace.
  • snapshot-fbfe59eff570171765df664280910c3bf1a4d56e233a5364cd8cb0152a35965b is an example name of an individual volume snapshot that is part of the volume group snapshot to use as source.
  1. Create the PVC by running the following command:
oc create -f <pvc-restore-filename>.yaml 
  1. Verify that the restored PVC has been created by running the following command:
oc get pvc

A new PVC with the name you specified in the first step appears.

Repeat the procedure as needed until all volumes are created from all the snapshots that are part of a volume group snapshot.

SBR
Category
Article Type