Kubernetes Persistent Volumes

Soldato
Joined
9 Mar 2012
Posts
10,072
Location
West Sussex, England
I'm currently teaching myself Kubernetes and have come across the following issue which I'm not sure is a bug or a feature. :rolleyes:

I've created a 'local-storage' storageClass with a volumeBindingMode = WaitForFirstConsumer, a Persistent Volume with a spec.capacity.storage = 5Gi, a Persistent Volume Claim with a spec.resources.requests.storage = 100Mi. These all seem to apply fine into my minikube cluster but when I apply the deployment that references this Persistent Volume Claim instead of it claiming 100Mi from the Persistent Volume, it takes the whole 5Gi.

Anyone here experienced this behaviour to comment?
 
Soldato
OP
Joined
9 Mar 2012
Posts
10,072
Location
West Sussex, England
I believe this is expected behaviour.

There is a 1 to 1 relationship between the PV and the PVC.

I dont think you have have multiople PVC's using the same PV.

Lets see if someone else agrees with me.

Thanks, would be interesting to know whether this is across the board and not just a limitation unique to hostpath and local.

It does also rather beg the question why you're able to specify a 'subPath' under spec.volumeMounts in a deployment though.
 
Last edited:
Soldato
OP
Joined
9 Mar 2012
Posts
10,072
Location
West Sussex, England
I suppose as a test, you can provision another physical volume but this time of a smaller capacity (say 300Mb) and see which one it chooses for the pvc.

My guess is it will use the smaller one.

Yes it did choose the smaller one then. I was just a bit surprised that the mechanism was 1:1 since dynamic provisioning also being a thing, but only it seems with some storage class provisioners.
 
Back
Top Bottom