<p>I setup a new k8s in a single node, which is tainted. But the <code>PersistentVolume</code> can not be created successfully, when I am trying to create a simple PostgreSQL.</p>

<p>There is some detail information below.</p>

<hr>

<p>The <code>StorageClass</code> is copied from the official page: <a href="https://kubernetes.io/docs/concepts/storage/storage-classes/#local" rel="noreferrer">https://kubernetes.io/docs/concepts/storage/storage-classes/#local</a></p>

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

<p>The <code>StatefulSet</code> is:</p>

<pre><code>kind: StatefulSet
apiVersion: apps/v1beta1
metadata:
  name: postgres
spec:
  serviceName: postgres
  replicas: 1
  ...
  volumeClaimTemplates:
    - metadata:
        name: postgres-data
      spec:
        storageClassName: local-storage
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: 1Gi
</code></pre>

<p>About the running <code>StorageClass</code>:</p>

<pre><code>$ kubectl describe storageclasses.storage.k8s.io
Name:            local-storage
IsDefaultClass:  No
Annotations:     kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"storage.k8s.io/v1","kind":"StorageClass","metadata":{"annotations":{},"name":"local-storage"},"provisioner":"kubernetes.io/no-provisioner","volumeBindingMode":"WaitForFirstConsumer"}

Provisioner:           kubernetes.io/no-provisioner
Parameters:            &lt;none&gt;
AllowVolumeExpansion:  &lt;unset&gt;
MountOptions:          &lt;none&gt;
ReclaimPolicy:         Delete
VolumeBindingMode:     WaitForFirstConsumer
Events:                &lt;none&gt;
</code></pre>

<p>About the running <code>PersistentVolumeClaim</code>:</p>

<pre><code>$ kubectl describe pvc
Name:          postgres-data-postgres-0
Namespace:     default
StorageClass:  local-storage
Status:        Pending
Volume:
Labels:        app=postgres
Annotations:   &lt;none&gt;
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode:    Filesystem
Events:
  Type       Reason                Age                            From                         Message
  ----       ------                ----                           ----                         -------
  Normal     WaitForFirstConsumer  &lt;invalid&gt; (x2 over &lt;invalid&gt;)  persistentvolume-controller  waiting for first consumer to be created before binding
</code></pre>

<p>K8s versions:</p>

<pre><code>$ kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.4", GitCommit:"c27b913fddd1a6c480c229191a087698aa92f0b1", GitTreeState:"clean", BuildDate:"2019-02-28T13:37:52Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T10:31:33Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

<p>The app is waiting for the Pod, while the Pod is waiting for a <code>PersistentVolume</code> by a <code>PersistentVolumeClaim</code>.
However, the <code>PersistentVolume</code> should be prepared by the user before using.</p>

<p>My previous YAMLs are lack of a <code>PersistentVolume</code> like this:</p>

<pre><code>kind: PersistentVolume
apiVersion: v1
metadata:
  name: postgres-data
  labels:
    type: local
spec:
  storageClassName: local-storage
  capacity:
    storage: 1Gi
  local:
    path: /data/postgres
  persistentVolumeReclaimPolicy: Retain
  accessModes:
    - ReadWriteOnce
  storageClassName: local-storage
  nodeAffinity:
    required:
      nodeSelectorTerms:
        - matchExpressions:
          - key: app
            operator: In
            values:
              - postgres
</code></pre>

<p>The local path <code>/data/postgres</code> should be prepared before using.
Kubernetes will not create it automatically.</p>
