Script to verify CSI configuration

Summary

This document explains a step-by-step process to run the cloudcasa-csi-checker.sh script which verifies that CSI is properly configured on a Kubernetes cluster. A working CSI installation requires many components, such as a CSI driver, external snapshotter, and snapshot CRDs.

How to run it?

You can run it without downloading first, as follows:

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

You can also download it first and then run it separately.

To see available options, run the script with --help or -h parameters. Note that the script assumes that kubectl is set up to point to the right cluster.

How does it work?

The script identifies the storage classes that use CSI drivers and for each such storage class, it finds volume snapshot classes (there can be more than one). Using this information, it performs the following operations for each storage class and volume snapshot class combination (in the namespace “csi-setup-test”):

  • Create a small sized PVC

  • Create a Pod and attach the PVC

  • Create a CSI snapshot

All created resources are automatically deleted.

At the end, the script prints a summary that should clearly indicate any errors or failures encountered and their possible reasons. The output (captured in storage.txt in the above command) contains more detailed information. In addition to the output, more debug information is captured in another text file called cc-validate-storage.debug.txt whose path is also printed to STDOUT.

One important thing to note is that the script uses the “busybox” image from the Docker Hub to create Pods. If your cluster cannot access Docker Hub, you can copy the image to a locally accessible repo and pass the URL of the image in couple of different ways:

  • By setting the environment variable CC_CSI_CHECK_BUSYBOX_IMAGE

  • Pass using command line option -i (this takes precedence over the env variable if present).

If you have any questions, need help in interpreting the script output, or have any generic questions regarding CSI set up, please contact CloudCasa support at support@cloudcasa.io.