<p>I am not sure if its a beginner level question but I thought of putting it here.
I am trying to setup <strong>Dynamic Volume Provisioning</strong> inside Kubernetes cluster.</p>
<p>But my Kubernetes cluster is running on my local virtual environment(I sping up my vagrant box using ubuntu and used kuberspray to provision my Kubernetes cluster). I followed this guide - <a href="https://jhooq.com/kubespray-12-steps-for-installing-a-production-ready-kubernetes-cluster/" rel="nofollow noreferrer">Setup Kubernetes cluster using kubespray</a></p>
<p>In short I am not using any cloud services, everything is running in VMs.</p>
<p>For <strong>Dynamic Volume Provisioning</strong> I have created a storage class -</p>
<pre><code>apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: jhooq-storage-class
provisioner: kubernetes.io/no-provisioner
parameters:
  type: pd-ssd
 
</code></pre>
<p>After that I have created the <strong>Persistent Volume Claim</strong></p>
<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: jhooq-pvc-with-sc
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: jhooq-storage-class
  resources:
    requests:
      storage: 1Gi
</code></pre>
<p>But I am facing an issue while applying the <strong>PVC</strong> configuration</p>
<p>Here is status of <strong>Persistent Volume Claim(PVC)</strong></p>
<pre><code>Name:          pvc-with-sc
Namespace:     default
StorageClass:  storage-class
Status:        Pending
Volume:        
Labels:        &lt;none&gt;
Annotations:   Finalizers:  [kubernetes.io/pvc-protection]
Capacity:      
Access Modes:  
VolumeMode:    Filesystem
Mounted By:    &lt;none&gt;
Events:
  Type     Reason              Age                   From                         Message
  ----     ------              ----                  ----                         -------
  Warning  ProvisioningFailed  100s (x182 over 46m)  persistentvolume-controller  no volume plugin matched
 
</code></pre>
<p>Am I missing something very basic here?
Or it is not possible in Virtual Environment?</p>
<p>Any suggestions or thoughts would be highly appreciated</p>

<p>Basically in your case you are just missing the PV.</p>
<p>According to <a href="https://kubernetes.io/docs/concepts/storage/storage-classes/#local" rel="nofollow noreferrer">k8s documentation</a>:</p>
<blockquote>
<p>Local volumes do not currently support dynamic provisioning, however a StorageClass should still be created to delay volume binding until Pod scheduling. This is specified by the WaitForFirstConsumer volume binding mode.</p>
</blockquote>
<p>So, even though it's not currently supported, you should still be able to create it.</p>
<p>Going through some <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/#create-a-persistentvolume" rel="nofollow noreferrer">docs</a>, I found out that you actually need to create the PV to have it bounded to your PVC, and you can define your storageClass within the PV definition, so in your case would be something like that:</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: local-pv
  labels:
    type: local-pv
spec:
  storageClassName: jhooq-storage-class
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: &quot;/whatever/path&quot;
</code></pre>
