What happens if you have a Filestorage of 1tb but a persistent volume claim of 20gb only?

8/3/2021

In Kubernetes, more specifically GKE, I created a Filestore volume, with the minimum of 1TB.

I created then a Persistent Volume Claim of 20gb.

What happens, if for another service I create another 20gb PVC ?

Specifically, how does this kind of storage work if you want to share the disk space between pods but having different data? Does Google make "batches" of X gb requested and this space is reserved in the disk?

-- JorgeeFG
google-cloud-filestore
google-kubernetes-engine
kubernetes
persistent-volume-claims
persistent-volumes

1 Answer

8/4/2021

There is a one-to-one mapping between a PVC and a PV, so you cannot create multiple PVCs pointing to the same PV.

But there are two possible ways you can share the underlying Filestore file share across multiple pods.

  1. You can share a single PVC across multiple pods. So you could create a single PVC with the total amount of storage you want across all your pods (or just set it to size of the Filestore instance). You would then mount the same PVC on all of your pods. To ensure that you don't have any data collision, each pod should write to it's own directory within the PVC. This will definitely work, but it won't limit or report the storage used by an individual pod.

  2. You can create multiple PVs backed by the same Filestore instance. When you create each PV, specify the storage size for each PV. Then create PVCs for each pod. I believe that you'd still want to make sure that each pod writes to a unique directory.

Lastly, unless you have a specific reason for using Filestore instances, consider using dynamic provisioning with GCE PDs.

-- Gari Singh
Source: StackOverflow