statefulset stuck on volumeClaimTemplates pending

11/5/2018

I have a stateful set to spin up a postgres database - using the following PV:

kind: PersistentVolume
apiVersion: v1
metadata:
  name: cryoem-daq-dev--postgres--dev-0
  labels:
    type: local
spec:
  storageClassName: cryoem-daq-dev--postgres--dev
  capacity:
    storage: 20Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: /gpfs/cryo/fs1/daq/dev/data/postgres-0

with the following statefulset:

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: postgres
  labels:
    name: postgres
    app: postgres
spec:
  serviceName: postgres
  updateStrategy:
    type: RollingUpdate
  replicas: 1
  selector:
    matchLabels:
      app: postgres
  template:
    metadata:
      labels:
        app: postgres
        environment: dev
    spec:
      nodeSelector:
        storage: gpfs
        group: cryoem
      containers:
      - name: postgres
        image: crunchydata/crunchy-postgres:centos7-10.5-2.1.0
        ports:
        - containerPort: 5432
          name: postgres
        volumeMounts:
        - mountPath: /pgdata
          name: pgdata
  volumeClaimTemplates:
    - metadata:
        name: postgres-data
      spec:
        accessModes: [ "ReadWriteOnce" ]
        storageClassName: cryoem-daq-dev--postgres--dev
        resources:
          requests:
            storage: 20Gi

however, when i create the statefulset, it gets stuck:

NAME       DESIRED   CURRENT   AGE   CONTAINERS   IMAGES
postgres   1         0         11m       postgres     crunchydata/crunchy-postgres:centos7-10.5-2.1.0

looking at the sts:

# kubectl -n cryoem-daq-dev get sts postgres -o yaml
  volumeClaimTemplates:
  - metadata:
      creationTimestamp: null
      name: postgres-data
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 20Gi
      storageClassName: cryoem-daq-dev--postgres--dev
    status:
      phase: Pending

however, looking at the pv and pvc's they look okay:

# kubectl  -n cryoem-daq-dev get pv
NAME                               CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS    CLAIM                                                  STORAGECLASS                       REASON    AGE
cryoem-daq-dev--postgres--dev-0    20Gi       RWO            Retain           Bound     cryoem-daq-dev/postgres-data-postgres-0                cryoem-daq-dev--postgres--dev                15m

# kubectl  -n cryoem-daq-dev get pvc
NAME                       STATUS    VOLUME                            CAPACITY   ACCESS MODES   STORAGECLASS                    AGE
postgres-data-postgres-0   Bound     cryoem-daq-dev--postgres--dev-0   20Gi       RWO            cryoem-daq-dev--postgres--dev   15m

i'm using v1.10.0 on the master and v1.10.3 on the node that i wish to schedule to.

help?!

-- yee379
kubernetes
statefulset
volume-claim-template

0 Answers