statefulset卡在volumeClaimTemplates上待处理

时间:2018-11-05 19:24:35

标签: kubernetes statefulset volume-claim-template

我有状态集来启动postgres数据库-使用以下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

具有以下状态集:

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

但是,当我创建有状态集时,它会卡住:

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

看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

但是,看着pv和pvc,它们看起来还不错:

# 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

我在主节点上使用v1.10.0,在希望调度的节点上使用v1.10.3。

帮助?!

0 个答案:

没有答案