<p>I am wondering what does &quot;capacity&quot; mean for Kubernetes persistent volume claim. Does that mean Kubernetes will schedule a pod with the volume you specified (e.g. 20 GB) on your cluster and that 20 GB space will be isolated or does it automatically scale down if you didn't fully use the 20 GB.</p>

franco mo
<p>From the <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#dynamic" rel="nofollow noreferrer">docs</a>:</p>
<blockquote>
<p>A PersistentVolumeClaim (PVC) is a request for storage by a user. It
is similar to a Pod. Pods consume node resources and PVCs consume PV
resources.</p>
</blockquote>
<p>So, a <code>PVC</code> is not an actual storage but a request for the storage. A <code>Persistent Volume (PV)</code> is the actual storage:</p>
<blockquote>
<p>A PersistentVolume (PV) is a piece of storage in the cluster that has
been provisioned by an administrator or dynamically provisioned using
Storage Classes.</p>
</blockquote>
<p>A <code>PVC</code> resource gets bound to the actual PV resource if there is a matching PV available. The physical storage can then be used by the pods by using the reference to the PVC in the pods spec <code>persistentVolumeClaim</code> field under <code>volumes</code>.</p>
<blockquote>
<p>I am wondering what does &quot;capacity&quot; mean for Kubernetes persistent
volume claim.</p>
</blockquote>
<p>The PVC resource do not have a <code>capacity</code> field but has a <code>storage</code> field which implies that this PVC resource will bound to a PV object if the matching capacity on the PV object has at least the amount of storage requested by the PVC object if provisioned statically.</p>
<p>PVC can also be configured to allow <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#dynamic" rel="nofollow noreferrer">dynamic provision</a> which implies the actual storage will be provisioned as part of the PVC creation if there is not a matching PV already in the cluster.</p>
<blockquote>
<p>Does that mean Kubernetes will schedule a pod with the volume you
specified (e.g. 20 GB) on your cluster and that 20 GB space will be
isolated or does it automatically scale down if you didn't fully use
the 20 GB.</p>
</blockquote>
<p>If you have configured dynamic provisioning for the cluster and create a PVC object then a matching PV object is created internally and the PVC gets bound to the same. <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/" rel="nofollow noreferrer">A pod needs to reference the PVC object to actually use it</a>. Further, storage resources do not get resized automatically based on the actual consumption. Once created they will be persisted until deleted explicitly and they have the lifecycle independent of the pods.</p>
