Search code examples
amazon-web-serviceskubernetespersistent-volumesamazon-efspersistent-volume-claims

Adding PersistentVolumeClaim on a different namespace with error 'failed to provision volume with StorageClass.. Missing provisioningMode parameter"


I am following https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html to link EFS to EKS. I have two namespace under my k8s clusters: dev and stage, and from I understand, I'd need to have two PersistentVolumeClaims that map to the shared PersistentVolume and StorageClass. So after I ran below 3 commands:

kubectl apply -f specs/pv.yaml
kubectl apply -f specs/claim.yaml
kubectl apply -f specs/storageclass.yaml

and from kubectl get sc,pv,pvc1 -n dev, I am able to see all 3 items just fine. However, as I tried to add to stage namespace - kubectl apply -f specs/claim.yaml --namespace=stage, I got below errors as efs-claim becomes stuck in a forever PENDING status:

Name:          efs-claim
Namespace:     stage
StorageClass:  efs-sc
Status:        Pending
Volume:        
Labels:        <none>
Annotations:   volume.beta.kubernetes.io/storage-provisioner: efs.csi.aws.com
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      
Access Modes:  
VolumeMode:    Filesystem
Used By:       foo-api-stage-chart-12345-abcde
               foo-api-stage-chart-12345-abcde
Events:
  Type     Reason                Age                From                                                                              Message
  ----     ------                ----               ----                                                                              -------
  Normal   Provisioning          107s               efs.csi.aws.com_ip-xxx  External provisioner is provisioning volume for claim "stage/efs-claim"
  Warning  ProvisioningFailed    107s               efs.csi.aws.com_ip-xxx  failed to provision volume with StorageClass "efs-sc": rpc error: code = InvalidArgument desc = Missing provisioningMode parameter
  Normal   ExternalProvisioning  4s (x8 over 107s)  persistentvolume-controller                                                       waiting for a volume to be created, either by external provisioner "efs.csi.aws.com" or manually created by system administrator

What is causing

efs.csi.aws.com_ip-xxx failed to provision volume with StorageClass "efs-sc": rpc error: code = InvalidArgument desc = Missing provisioningMode parameter

I did not have to provide such parameter on dev namespace so why it is required for a different namespace like stage?


Solution

  • To resolve the error that you are seeing, re-apply your StorageClass with:

    ...
    parameters:
      provisioningMode: efs-ap
      fileSystemId: <ID of the file system created on EFS>
    ...
    

    If multiple pods going to read/write to the file system, re-apply PersistentVolume with:

    ...
    spec:
      ...
      accessModes:
      - ReadWriteMany
    ...
    

    Should the problem persist do post your StorageClass, PersistentVolumeClaim and PersistentVolume spec in your question.