<p>Is it required to create the directory manually in nodes or will it be auto created by pv?</p>

<p>Here is my pv &amp; pvc file, and I'm seeing this error </p>

<blockquote>
  <p>no persistent volumes available for this claim and no storage class is set</p>
</blockquote>

<p>how to resolve this?  </p>

<pre><code>kind: PersistentVolume
apiVersion: v1
metadata:
name: zk1-pv
labels:
  type: local
spec:
storageClassName: manual
capacity:
  storage: 10Mi
accessModes:
  - ReadWriteOnce
hostPath:
  path: "/mr/zk"

cat zk1-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: zk1-pvc
spec:
accessModes:
  - ReadWriteOnce
resources:
  requests:
    storage: 10Mi


kubectl describe pvc zk1-pvc
Name:          zk1-pvc
Namespace:     instavote
StorageClass:
Status:        Pending
Volume:
Labels:        &lt;none&gt;
Annotations:   kubectl.kubernetes.io/last-applied-configuration:
               {"apiVersion":"v1","kind":"PersistentVolumeClaim","metadata":{"annotations":{},"name":"zk1-pvc","namespace":"instavote"},"spec":{"accessMo...
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
Events:
Type       Reason         Age                  From                         Message
----       ------         ----                 ----                         -------
Normal     FailedBinding  12s (x14 over 3m7s)  *persistentvolume-controller  no persistent volumes available for this claim and no storage class is set*
Mounted By:  zk1-745b7cbf46-lg7v9
</code></pre>

<p><strong>Back to your main question</strong></p>

<blockquote>
  <p>Is it required to create the directory manually in nodes or will it be
  auto created by pv?</p>
</blockquote>

<p>First of all, error in your output <strong>is not related</strong> with your question. As an answer for your question - Yes. It is crated by PV automatically. </p>

<p>In order to do achieve this, first you have to create <code>StorageClass</code> with <code>no-provisioner</code> as an example below</p>

<pre><code>kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: manual
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
</code></pre>

<p>Then you have to create <code>PersistentVolume</code> by defining this <code>storageClassName</code> and <code>hostPath</code> parameter like below:</p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: zk1-pv
spec:
  storageClassName: manual
  capacity:
    storage: 1Gi
  accessModes:
  - ReadWriteOnce
  hostPath:
    path: /mr/zk
</code></pre>

<p>Then you have to create PVC and Pod/Deployment as an example below: </p>

<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: myclaim
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

---
apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  containers:
    - name: containerName
      image: gcr.io/google-containers/nginx:1.7.9
      volumeMounts:
      - mountPath: "/var/www/html"
        name: mypd
  volumes:
    - name: mypd
      persistentVolumeClaim:
        claimName: myclaim
</code></pre>

<p><strong>NOTE:</strong> <br/>
Don't forget put <code>storageClassName: manual</code> parameter on both PVC and PV manifests. Otherwise they will not be able to bound to each other.</p>

<p>Hope it clears</p>
