How to limit resource usage on local storage?


I a using kubernetes 1.14. and I am using local storage: Volumes - Kubernetes

I am mouting a directory.
When creating PV and PVC I set 30Gi for the size.

kubectl get pv

NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                                          STORAGECLASS    REASON   AGE
storage-data-poc-es-master-0               30Gi       RWO            Delete           Bound    default/storage-data-poc-es-master-1           local-storage            2d18h
storage-data-poc-es-master-1               30Gi       RWO            Delete           Bound    default/storage-data-poc-es-master-0           local-storage            2d18h
storage-data-poc-es-master-2               30Gi       RWO            Delete           Bound    default/storage-data-poc-es-master-2           local-storage            2d18h

kubectl get pvc

NAME                                   STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS    AGE
storage-data-poc-es-master-0           Bound    storage-data-poc-es-master-1               30Gi       RWO            local-storage   2d18h
storage-data-poc-es-master-1           Bound    storage-data-poc-es-master-0               30Gi       RWO            local-storage   2d18h
storage-data-poc-es-master-2           Bound    storage-data-poc-es-master-2               30Gi       RWO            local-storage   2d18h

But my application is saying there are 120GB free what is fitting the underlying drive.
What options do I have to limit the local storage (transparently) to my application?


You cannot limit local storage through kubernetes directly. You would need to create a volume on the host that has the desired limitation ahead of time with something like lvm.

thanks, hoped it would be easier :wink:

1 Like