IBM Spectrum Scale CSI driver allows IBM Spectrum Scale to be used as persistent storage for containerized applications running in Kubernetes or Red Hat OpenShift cluster. Using the IBM Spectrum Scale CSI driver, Kubernetes persistent volumes (PVs) can be provisioned based on filesets or directories, from different filesystems and even from remotely mounted filesystems. The CSI driver can easily be deployed and managed using the IBM Spectrum Scale CSI Operator.
Version 2.4.0 of the IBM Spectrum Scale CSI driver was released on 10th December 2021. This release added support for CSI Spec v1.3.0, Red Hat OpenShift 4.9 platform and upgrades to Kubernetes sidecar containers. It also brings in support for two key features:
- CSI Volume Cloning which provides ability to clone a persistent volume.
- CSI Volume Expansion which provides support for volume expansion after volume creation.
Currently, volume cloning and expansion features are supported for dynamically provisioned volumes. Volume cloning functionality requires IBM Spectrum Scale v5.1.1.2 or higher.
Let's walk through to see how to use these features when running stateful applications on Kubernetes or Red Hat OpenShift.
Deploying the IBM Spectrum Scale CSI Driver
To install the v2.4.0 of IBM Spectrum Scale CSI Driver, please check the IBM Documentation at https://www.ibm.com/docs/en/spectrum-scale-csi?topic=240-installation
Getting Started
Let's first create a sample StorageClass and PersistentVolumeClaim which would be referred further in examples.
As currently volume cloning and volume expansion is supported for dynamically provisioned volumes, below example shows storage class for a fileset. To allow volume expansion the allowVolumeExpansion field is set to true in the StorageClass. Here it is assumed that the user wants to create PVCs under the file system gpfs0. "8809226123290901444" is the cluster ID of the primary cluster.
# cat storageclass.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ibm-spectrum-scale-csi-fileset-sc
provisioner: spectrumscale.csi.ibm.com
parameters:
volBackendFs: gpfs0
clusterId: "8809226123290901444"
reclaimPolicy: Delete
allowVolumeExpansion: true
# cat pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ibm-spectrum-scale-csi-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
storageClassName: ibm-spectrum-scale-csi-fileset-sc
Note: All YAML files presented in this blog can be applied with kubectl apply -f <filename> on Kubernetes. Replace ‘kubectl’ with ‘oc’ for Red Hat OpenShift.
Creating a Volume Clone
Sample PersistentVolumeClaim
Here, specify existing PVC in the dataSource field of the PVC to indicate the volume user wants to clone.
# cat volclone_pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ibm-spectrum-scale-csi-pvc-clone
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: ibm-spectrum-scale-csi-fileset-sc
dataSource:
kind: PersistentVolumeClaim
name: ibm-spectrum-scale-csi-pvc
Notes:
- The storage capacity of the cloned volume must be the same or larger than the capacity of the source volume.
- The destination persistent volume claim (PVC) must exist in the same namespace as the source PVC.
- The source and destination storage class must be the same.
- The source PVC must be bound and available but must not be in use.
- Volume cloning of lightweight volumes on remote file systems is not supported.
Expanding a Persistent Volume
Sample patch to increase capacity of a persistent volume
# kubectl patch pvc ibm-spectrum-scale-csi-pvc -p '{"spec":{"resources":{"requests":{"storage":"5Gi"}}}}}'
Note: If the persistent volume was created using IBM Spectrum Scale CSI v2.3.1 or less, then allowVolumeExpansion must not be set in StorageClass. One must patch the existing storage class as shown here, prior to volume expansion.
# kubectl patch storageclass ibm-spectrum-scale-csi-fileset-sc -p '{"allowVolumeExpansion": true}'
For more information of IBM Spectrum Scale CSI Driver v2.4.0 release check:
https://www.ibm.com/docs/en/spectrum-scale-csi?topic=spectrum-scale-container-storage-interface-driver-240
References:
1. IBM Spectrum Scale Container Storage Interface Driver
https://www.ibm.com/docs/en/spectrum-scale-csi
2. IBM Spectrum Scale CSI Driver Source Code Repository
https://github.com/IBM/ibm-spectrum-scale-csi
#redhatopenshift
#csi#spectrumscale