<p>I have this persistent volume claim</p>
<pre><code>$ kubectl get pvc -ngitlab-managed-apps
NAME                           STATUS    VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
prometheus-prometheus-server   Pending                                                     0s


$ kubectl describe pvc prometheus-prometheus-server -ngitlab-managed-apps
Name:          prometheus-prometheus-server
Namespace:     gitlab-managed-apps
StorageClass:  
Status:        Pending
Volume:        
Labels:        app=prometheus
               chart=prometheus-9.5.2
               component=server
               heritage=Tiller
               release=prometheus
Annotations:   &lt;none&gt;
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      
Access Modes:  
VolumeMode:    Filesystem
Mounted By:    prometheus-prometheus-server-78bdf8f5b7-pkvcr
Events:
  Type    Reason         Age                From                         Message
  ----    ------         ----               ----                         -------
  Normal  FailedBinding  14s (x5 over 60s)  persistentvolume-controller  no persistent volumes available for this claim and no storage class is set
</code></pre>
<p>And I have created this persistent volume</p>
<pre><code>$ kubectl get pv
NAME                           CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS     CLAIM                                              STORAGECLASS   REASON   AGE
prometheus-prometheus-server   8Gi        RWO            Retain           Released   gitlab-managed-apps/prometheus-prometheus-server   manual                  17m

$ kubectl describe pv prometheus-prometheus-server
Name:            prometheus-prometheus-server
Labels:          type=local
Annotations:     kubectl.kubernetes.io/last-applied-configuration:
                   {&quot;apiVersion&quot;:&quot;v1&quot;,&quot;kind&quot;:&quot;PersistentVolume&quot;,&quot;metadata&quot;:{&quot;annotations&quot;:{},&quot;labels&quot;:{&quot;type&quot;:&quot;local&quot;},&quot;name&quot;:&quot;prometheus-prometheus-server&quot;}...
                 pv.kubernetes.io/bound-by-controller: yes
Finalizers:      [kubernetes.io/pv-protection]
StorageClass:    manual
Status:          Released
Claim:           gitlab-managed-apps/prometheus-prometheus-server
Reclaim Policy:  Retain
Access Modes:    RWO
VolumeMode:      Filesystem
Capacity:        8Gi
Node Affinity:   &lt;none&gt;
Message:         
Source:
    Type:          HostPath (bare host directory volume)
    Path:          /var/prometheus-server
    HostPathType:  
Events:            &lt;none&gt;
</code></pre>
<p>Why is the claim not claiming the volume? Besides the name, is there anything else that needs to match? Are there any logs I should look into? For now I only see &quot;no persistent volumes available for this claim and no storage class is set&quot;</p>

CyberProdigy
<p>To understand the error message, you need to understand how <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#static" rel="noreferrer">static</a> and <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#dynamic" rel="noreferrer">dynamic</a> provisioning work.</p>
<blockquote>
<p>When none of the static PVs the administrator created matches a user's PersistentVolumeClaim, the cluster may try to dynamically provision a volume especially for the PVC. This provisioning is based on StorageClasses.</p>
</blockquote>
<blockquote>
<p>After you create the PersistentVolumeClaim, the Kubernetes control plane looks for a PersistentVolume that satisfies the claim's requirements. If the control plane finds a suitable PersistentVolume with the same StorageClass, it binds the claim to the volume.</p>
</blockquote>
<p>Your error says,&quot;Your PVC hasn't found a matching PV and you also haven't mentioned any storageClass name&quot;.</p>
<p>Your PV has <code>StorageClass: manual</code>, but your PVC doesn't have any storageClass (<code>StorageClass: &quot;&quot;</code>). Adding <code>StorageClass: manual</code> to your PVC should solve your problem.</p>
<p>You must need to choose one of the following provisioning options.</p>
<p><strong>Static provisioning:</strong></p>
<ul>
<li>create PV</li>
<li>create PVC with the label selector, so that it can find the PV with labels mentioned.</li>
</ul>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: myclaim
spec:
  selector: # &lt;----- here
    matchLabels:
      release: &quot;stable&quot;
... ...
</code></pre>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: myclaim
  label: # &lt;---- here
    release: &quot;stable&quot;
</code></pre>
<p><strong>Dynamic provisioning:</strong></p>
<ul>
<li>create <a href="https://kubernetes.io/docs/concepts/storage/storage-classes/" rel="noreferrer">storageClass</a> with provisioner mentioned</li>
<li>create PVC with the storageClass name mentioned</li>
</ul>
<p>Or</p>
<ul>
<li>create both PV and PVC with the same storageClass name mentioned.</li>
</ul>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: slow
provisioner: some-provisioner 
... ... ...
</code></pre>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: myclaim
spec:
  storageClassName: slow # &lt;---- here
... ... ...
</code></pre>
<p>This is a short description, please visit the <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/" rel="noreferrer">official doc</a> for more details.</p>
