zalando / postgres-operator

Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
https://postgres-operator.readthedocs.io/
MIT License
4.35k stars 980 forks source link

Having trouble with persistent volume claim for minimal example #1011

Open B45man opened 4 years ago

B45man commented 4 years ago

Hi, I'm following the quickstart for this operator. I have succesfully set up the operator itself, but the minimal-postgres-manifest.yaml is giving me trouble. It seems to run correctly, but the PVC that it creates can not connect to the NFS volume I have set up. See the below screenshot:

image

I have first tried to create a persistent volume manually using this simple file:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: pgdata-acid-minimal-cluster-0
spec:
  capacity:
    storage: 5Gi 
  accessModes:
    - ReadWriteMany 
  persistentVolumeReclaimPolicy: Retain
  nfs:
    server: 123.456.789.10
    path: /the/correct/path 

And I tried setting up a storage class:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: pgdata-acid-minimal-cluster-0
  labels:
    name: nfs-persistentvolume 
spec:
  storageClassName: manual 
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteMany
  nfs:
    server: 123.456.789.10 
    path: "/the/correct/path" 

But both ways, I end up with a PVC that doesn't want to connect to my volume. What am I doing wrong?

FxKu commented 4 years ago

The operator relies on dynamic volume provisioning. If this doesn't work in your setup than yes, you can create PVs beforehand and you can also set the storageClass in the volume section of the manifest.

Maybe looking into this issue can also help.

TheAceMan commented 9 months ago

I was having a similar issue. I was using volume.selector.matchLabels and the pvc would just sit at pending. If I changed the PV to ReadWriteOnce it worked as expected. I was not able to find any documentation stating that selectors would only bound to ReadWriteOnce volumes, not sure if that is a Kubernetes standard or to this operator or if it's a bug.