The app is waiting for the Pod, while the Pod is waiting for a PersistentVolume
by a PersistentVolumeClaim
.
However, the PersistentVolume
should be prepared by the user before using.
My previous YAMLs are lack of a PersistentVolume
like this:
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
The local path /data/postgres
should be prepared before using.
Kubernetes will not create it automatically.