Search code examples
kubernetesgoogle-cloud-platformgoogle-kubernetes-enginepersistent-volumes

How to create a dynamic persistent volume claim with ReadWriteMany access in GKE?


Currently GCEPersistentDisk does not support ReadWriteMany natively, there are other options like filestore which creates a NFS volume, but there are 2 problem here:

  1. minimum 1 TB size is needed to be created

  2. secondly its a manually effort of creating PVs and then PVCs

Whats the best solutions for dynamically allocating a claim request in GKE ?


Solution

  • If you have requirement of dynamic provising with you can alos try using the Gluster FS or Minio.

    here is one nice example using the GlusterFS dynamic provisioning : https://docs.openshift.com/container-platform/3.9/install_config/storage_examples/gluster_dynamic_example.html

    you have to create the storageclass

    kind: StorageClass
    apiVersion: storage.k8s.io/v1
    metadata:
      name: glusterfs
    provisioner: kubernetes.io/glusterfs
    parameters:
      resturl: "http://10.42.0.0:8080" 
      restauthenabled: "false"
    

    and create the PVC with specific storageclass

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: gluster1
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 30Gi
      storageClassName: glusterfs
    

    Also, You can create Filestore file shares between 1 and 63.9 TiB and dynamic provisioning: https://cloud.google.com/community/tutorials/gke-filestore-dynamic-provisioning