3
votes

Storage size which I specified in the persistent volume claim ignores with using nfs as a storage backend.

I want to attach persistent volume to container with specified volume size. The following is the yaml file which I used to create pvc.

kind: PersistentVolumeClaim 
apiVersion: v1
metadata:  
 name: test-claim  
 annotations:
  volume.beta.kubernetes.io/storage-class: "managed-nfs-storage" 
spec:
  accessModes:
   - ReadWriteMany
  resources:
  requests:
    storage: 1Mi

The following is the result of created pvc.

NAME   STATUS    VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS      AGE
test-claim   Bound     pvc-bd0fdb84-f73c-11e7-bdd5-0050569b0869   1Mi        RWX            managed-nfs-storage   6m

Finally, I attached created volume to container and see the size of mounted file system, it shows the total amount of disk size which I export using NFS.

Does anybody know how to enable request storage size parameter? In other words, Is there any way to specify the size of volumes when using NSF as a backend storage?

1

1 Answers

1
votes

Simply put, no, it's not possible.

The storage parameter is used for matching PVC to a PV, and for autoprovisioning PVs when supported (ie. adding an EBS on AWS). Kubernetes it self has no means of managing filesystem quota whatsoever.

One thing that could help is if you'd automaticaly provision NFS to share a particular mount point on the server that is created with this limit (ie. as separate LVM LV, btrfs or zfs). You can also think about switching to something like GlusterFS with its provisioning API heketi