Unable to modify the StorageClass created by the SharedVolume.

Solution Verified - Updated -

Environment

  • Red Hat OpenShift Service on AWS

Issue

  • Pod permission issue with persistent storage volumes.
  • Permission issue when provisioning a pod using EFS CSI driver operator and modifying StorageClasses objects.

Resolution

  • The StorageClasses are immutable objects hence can not be modified
  • The parameters of the StorageClass can not be changed once it is created.
  • The StorageClass can only be Deleted and recreated with fields like provisioner , parameters, and
    reclaimPolicy as mentioned below:
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: efs-sc
provisioner: efs.csi.aws.com
mountOptions:
  - tls
parameters:
  provisioningMode: efs-ap
  fileSystemId: fs-92107410
  directoryPerms: "700"
  gidRangeStart: "1000"
  gidRangeEnd: "2000"
  basePath: "/dynamic_provisioning"

Root Cause

  • The StorageClasses are immutable objects hence can not be modified therefore need to delete and recreate the
    StogageClass whenever required.

Diagnostic Steps

The PV, PVC and StorageVolumes are created automatically once the SharedVolume is defined.

$ oc get pv PV1
NAME             CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                                STORAGECLASS   REASON   AGE
PV1                    300Gi      RWX            Retain           Bound    Namespace/PVC1   efs-sc                  20h

$ oc get pvc -n <namespace>

NAME            STATUS    VOLUME             CAPACITY   ACCESS MODES   STORAGECLASS    AGE
PVC2             Bound          pvc1                      100Gi           RWO                           gp2                               20h
PVC1              Bound          pvc2                    300Gi          RWX                            efs-sc                           20h 

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments