0/2 nodes are available: 1 node(s) didn't find available persistent volumes to bind, 1 node(s) had taints that the pod didn't tolerate

11/4/2019

I setup a k8s in a multiple node. But the PersistentVolume can not be created successfully, when I am trying to create a simple PostgreSQL.

The StorageClass

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

The StatefulSet is:

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: postgres
  namespace: kong
spec:
  replicas: 1
  selector:
    matchLabels:
      app: postgres
  serviceName: postgres
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
      - env:
          ...           
      volumeMounts:
        - mountPath: /var/lib/postgresql/data
          name: my-local-pv
          subPath: pgdata
      terminationGracePeriodSeconds: 60
  volumeClaimTemplates:
  - metadata:
      name: my-local-pv
    spec:
      storageClassName: local-storage
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 1Gi

The describe pod:

Name:           postgres-0
Namespace:      kong
Priority:       0
Node:           <none>
Labels:         app=postgres
                controller-revision-hash=postgres-9c9cf868d
                statefulset.kubernetes.io/pod-name=postgres-0
Annotations:    <none>
Status:         Pending
IP:             
IPs:            <none>
Controlled By:  StatefulSet/postgres
Containers:
  postgres:
    Image:      postgres:9.5
    Port:       5432/TCP
    Host Port:  0/TCP
    Environment:
      POSTGRES_USER:      kong
      POSTGRES_PASSWORD:  kong
      POSTGRES_DB:        kong
      PGDATA:             /var/lib/postgresql/data/pgdata
    Mounts:
      /var/lib/postgresql/data from postgres-data (rw,path="pgdata")
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-b5mkt (ro)
Conditions:
  Type           Status
  PodScheduled   False 
Volumes:
  postgres-data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  postgres-data-postgres-0
    ReadOnly:   false
  default-token-b5mkt:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-b5mkt
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age        From               Message
  ----     ------            ----       ----               -------
  Warning  FailedScheduling  <unknown>  default-scheduler  0/2 nodes are available: 1 node(s) didn't find available persistent volumes to bind, 1 node(s) had taints that the pod didn't tolerate.
  Warning  FailedScheduling  <unknown>  default-scheduler  0/2 nodes are available: 1 node(s) didn't find available persistent volumes to bind, 1 node(s) had taints that the pod didn't tolerate.

kubectl get pv:

NAME          CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM                STORAGECLASS       REASON   AGE
my-local-pv   2Gi      RWO            Retain           Available                        local-storage            3m59s

Please help me. Thanks in advance

-- Akashii
kubernetes
persistent-storage
persistent-volumes

0 Answers