<p>I am getting error of </p>

<blockquote>
  <p>1 node(s) didn't find available persistent volumes to bind.</p>
</blockquote>

<p>upon creating my pod to attach to Persistent Storage.</p>

<p>I have setup below. </p>

<p><code>PersistentVolume</code> and <code>StorageClass</code> created and attached successfully.
Once I create PersistentVolumeClaim, it waits in "pending" state, which is expected (I believe) because 
it waits a pod to connect due to "<code>WaitForFirstConsumer</code>" setting of <code>StorageClass</code>.</p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: example-local-pv
spec:
  capacity:
    storage: 2Gi
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: local-storage
  local:
    path: /home/aozdemir/k8s
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - my-node
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: example-local-claim
spec:
  accessModes:
  - ReadWriteOnce
  storageClassName: local-storage
  resources:
    requests:
      storage: 2Gi
---
kind: Pod
apiVersion: v1
metadata:
  name: task-pv-pod
spec:
  volumes:
    - name: task-pv-storage
      persistentVolumeClaim:
       claimName: example-local-claim
  containers:
    - name: task-pv-container
      image: nginx
      ports:
        - containerPort: 80
          name: "http-server"
      volumeMounts:
        - mountPath: "/usr/share/nginx/html"
          name: task-pv-storage
</code></pre>

<p>My problem is that, after I create the Pod, it gives following warning:</p>

<blockquote>
  <p>0/1 nodes are available: 1 node(s) didn't find available persistent
  volumes to bind.</p>
</blockquote>

<p>Here is screenshot:</p>

<p><a href="https://i.stack.imgur.com/fuehs.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fuehs.png" alt="enter image description here"></a></p>

<p>Am I missing something here?</p>

Teoman shipahi
<p>It was my bad.
Due to following blog post: <a href="https://kubernetes.io/blog/2018/04/13/local-persistent-volumes-beta/" rel="noreferrer">https://kubernetes.io/blog/2018/04/13/local-persistent-volumes-beta/</a></p>

<blockquote>
  <p>Note that there’s a new <strong>nodeAffinity</strong> field in the PersistentVolume
  object: this is how the Kubernetes scheduler understands that this
  PersistentVolume is tied to a specific node. nodeAffinity is a
  <strong>required field for local PersistentVolumes</strong>.</p>
</blockquote>

<p>and my value was incorrect. I changed it to my node name, and re-deployed, it worked.</p>
