Kubernetes Error: failed to provision volume with StorageClass “gp2”: rpc error: code = InvalidArgumentKubernetes Error:

Error:

Normal   WaitForPodScheduled   3m5s                  persistentvolume-controller                                                              waiting for pod kube-prometheus-stack-grafana-59d698c77f-kk74w to be scheduled
  Normal   Provisioning          49s (x8 over 2m57s)   ebs.csi.aws.com_ebs-csi-controller-676b6876c-t4wz8_1d14b6af-c9fe-4d6f-a6e0-2dd8e3766296  External provisioner is provisioning volume for claim "management/kube-prometheus-stack-grafana"
  Warning  ProvisioningFailed    49s (x8 over 2m57s)   ebs.csi.aws.com_ebs-csi-controller-676b6876c-t4wz8_1d14b6af-c9fe-4d6f-a6e0-2dd8e3766296  failed to provision volume with StorageClass "gp2": rpc error: code = InvalidArgument desc = Volume capabilities MULTI_NODE_MULTI_WRITER not supported. Only AccessModes[ReadWriteOnce] supported.
  Normal   ExternalProvisioning  10s (x15 over 2m57s)  persistentvolume-controller                                                              waiting for a volume to be created, either by external provisioner "ebs.csi.aws.com" or manually created by system adm
$ deployable-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"PersistentVolumeClaim","metadata":{"annotations":{},"finalizers":["kubernetes.io/pvc-protection"],"labels":{"app.kubernetes.i
o/instance":"kube-prometheus-stack","app.kubernetes.io/managed-by":"Helm","app.kubernetes.io/name":"grafana","app.kubernetes.io/version":"8.0.1","helm.sh/char
t":"grafana-6.12.1"},"name":"kube-prometheus-stack-grafana","namespace":"management"},"spec":{"accessModes":["ReadWriteMany"],"resources":{"requests":{"storag
e":"10Gi"}},"storageClassName":"efs"}}
    volume.beta.kubernetes.io/storage-provisioner: efs.csi.aws.com
    volume.kubernetes.io/storage-provisioner: efs.csi.aws.com
  finalizers:
  - kubernetes.io/pvc-protection
  labels:
    app.kubernetes.io/instance: kube-prometheus-stack
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: grafana
    app.kubernetes.io/version: 8.0.1
    helm.sh/chart: grafana-6.12.1
  name: kube-prometheus-stack-grafana
  namespace: management
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 10Gi
  storageClassName: gp2
  volumeMode: Filesystem

Solution

The error you are seeing indicates that the EBS CSI driver does not support the ReadWriteMany access mode. EBS volumes can only be mounted with ReadWriteOnce in a single node.

Here’s the main problem:

In your PVC definition, you have:

accessModes: - ReadWriteMany

With the storage class gp2, which is backed by EBS, the ReadWriteMany access mode is not valid. EBS volumes can only support ReadWriteOnce.

To fix this issue:

  1. Update the accessModes in your PVC to use ReadWriteOnce:accessModes: - ReadWriteOnce
  2. Reapply the PVC: kubectl apply -f deployable-pvc.yaml

If you truly need a shared filesystem that supports ReadWriteMany, consider using Amazon EFS. However, ensure that you have an appropriate StorageClass set up that provisions EFS volumes. In this case, your original storage class efs would have been appropriate, but ensure you have all the necessary components in place to provision EFS volumes using the EFS CSI driver.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x