Views:

Summary

This KB Article explains the steps to verify if a particular CSI driver is configured properly on a Kubernetes Cluster.

NOTE: This article assumes that the user has already configured the PVCs using the same CSI driver. We also assume that the "v1" version of Snapshot API is available on the cluster.


Step-by-Step

Please run the below script to automatically verify if the CSI is correctly configured:

$ curl -s https://raw.githubusercontent.com/catalogicsoftware/cloudcasa-artifacts/master/scripts/cloudcasa-csi-checker.sh | bash 2>&1 - | tee storage.txt

 

Below are the manual steps to verify the CSI driver configuration:

1. Identify a PVC you want to snapshot. Ensure that PVC is using CSI and identify the CSI driver.


2. Make sure that there is a VolumeSnapshotClass for the CSI driver. If not, create one. Here is a sample:

apiVersion: snapshot.storage.k8s.io/v1
    kind: VolumeSnapshotClass
    metadata:
      name: my-snapshotclass

    driver: <CSI_DRIVER>>
    deletionPolicy: Delete
   


Note that some CSI drivers require custom properties to be set in a volume snapshot class. Please refer to the documentation of your CSI driver. If such configuration is required, you would pass parameters in the field ``parameters``. Here is an example:

parameters:
    param1: param1-value
 

 

Note that Snapshot CRDs need to be installed if they are not already present (available at: https://github.com/kubernetes-csi/external-snapshotter ) 

 

3. Create VolumeSnapshot resource which acts as a request to create the snapshot of a PVC. Here is a sample spec:

apiVersion: snapshot.storage.k8s.io/v1
     kind: VolumeSnapshotClass

     metadata:
      name: my-snapshotclass
spec:
      volumeSnapshotClassName: my-snapshotclass
      source:
        persistentVolumeClaimName: my-pvc

 


4. Wait a minute and check if the corresponding VolumeSnapshotContent resource is created. It is the job of the external snapshotter to create a VolumeSnapshotContent resource on seeing a VolumeSnapshot. So if such a resource is not created in a reasonable time, check if the external snapshotter controller is installed properly and is running. 


5. If VolumeSnapshotContent is created, the CSI driver should proceed with creating a storage snapshot and then update the VolumeSnapshotContent with the snapshot handle. Wait for some reasonable amount of time and check you see the ``snapshotHandle`` set. 

   If it is not set, there must be some problem with the CSI driver. Check the CSI driver can handle the "v1" version of Snapshot APIs. Verify if the driver requires any custom parameters in the    VolumeSnapshotClass resource. It is also possible that the CSI driver does not implement Snapshot APIs. 

If everything goes well, you should see the fields "snapshotHandle" and "readyToUse" set in both VolumeSnapshot and VolumeSnapshotContent resources.

Finally, don't forget to delete all the resources created for the testing (such as VolumeSnapshot).

 

Related Products: CloudCasa