Setting custom mount options with CSI plugin

Content Software for File CLI Reference

Version
4.2.x
Audience
anonymous
Part Number
MK-HCSF001-03

This example procedure demonstrates how to set custom mount options using the Content Software for File CSI plugin.

  • The Kubernetes environment is set up and accessible.
  • The kubectl command-line tool is installed and configured.
  1. Create storage class.
    1. Open or create a YAML file for your StorageClass definition (for example, storageclass-wekafs-mountoptions.yaml).
    2. Add the following content to define the StorageClass with custom mount options:
      apiVersion: storage.k8s.io/v1 
      kind: StorageClass
      metadata:
      name: storageclass-wekafs-mountoptions 
      provisioner: <YOUR_PROVISIONER> 
      parameters:
      mountOptions: "rw,relatime,readcache,noatime,readahead_kb=32768,dentry_max_

      Replace <YOUR_PROVISIONER>with the appropriate CSI provisioner.

    3. Apply the StorageClass using the following command:
      kubectl apply -f storageclass-wekafs-mountoptions.yaml
  2. Create CSI secret:
    Execute the following command to create a CSI secret named csi-wekafs-api-secret (located in ../common/csi-wekafs-ap i-secret.yaml):
    kubectl apply -f storageclass-wekafs-mountoptions.yaml
    This step ensures that the necessary credentials are available for the CSI plugin.
  3. Provision a new volume:
    Apply the StorageClass to provision a new volume. Use the following command:
    kubectl apply -f <FILE>.yaml

    Replace <FILE> with the path to your YAML file containing the Persistent Volume Claim (PVC) definition.

  4. Create application:
    1. Create an application manifest file (for example, csi-app-fs-mountoptions.yaml or use an existing one.
    2. In the manifest, specify the PVC with the custom mount options:
      apiVersion: apps/v1 
      kind: Deployment 
      metadata:
      name: csi-app-fs-mountoptions 
      spec:
      replicas: 1 
      selector:
      matchLabels:
      app: csi-app-fs-mountoptions template:
      metadata: labels:
      app: csi-app-fs-mountoptions 
      spec:
      containers:
      name: csi-app-fs-mountoptions 
      image: <YOUR_IMAGE> 
      volumeMounts:
      mountPath: "/data" 
      name: wekafs-volume
      volumes:
      name: wekafs-volume 
      persistentVolumeClaim:
      claimName: pvc-wekafs-fs-mountoptions
      

      Replace <YOUR_IMAGE> with the desired container image.

    3. c. Deploy the application:
      kubectl apply -f csi-app-fs-mountoptions.yaml
  5. Attach and validate:
    1. Attach to the application pod:
      kubectl exec csi-app-fs-mountoptions -- mount -t wekafs
    2. Verify that the output resembles to the following example:
      csivol-pvc-15a45f20-Z72GJXDCEWQ5 on /data type wekafs (rw,relatime,readcache,