postgres-operator
postgres-operator copied to clipboard
Clusters aren't working properly when created with 1 replica
Overview
I create 2 clusters with a helm chart, using a yaml template.
I create users using the users:
in the yaml in both times. I found out that the cluster with 1 replica doesn't create the users after the creation. I checked this by connecting to the postgres pod and running a \du
.
So I tried changing variables around and deleting and recreating the postgrecluster resource, and only when creating the cluster with 2 replicas I found out that the users are being created. I also found out that these clusters with the single replica aren't being scaled up when I change the yaml to be 2 replicas after I initially created the cluster with 1.
I checked in the postgresclusters resource and the changes are happening there, but I guess the operator isn't triggering any changes to occur to the actual postgres/statefulset.
I looked in the pgdata/<Cluster Name>/logs
directory but didn't find any logs referencing the users that aren't being created. I also looked at the operator logs and didn't find anything.
I am currently running on k3s version v1.22.6+k3s1, but this also happened to me on an AKS cluster.
I also think this might be something with synchronous replication configured, as I see that also when creating a user with psql
commands, they hang.
apiVersion: postgres-operator.crunchydata.com/v1beta1
kind: PostgresCluster
metadata:
name: REDACTED
spec:
patroni:
dynamicConfiguration:
synchronous_mode: true
synchronous_mode_strict: true
image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres:centos8-13.5-0
postgresVersion: 13
users:
- databases:
- REDACTED
- postgres
name: REDACTED
options: SUPERUSER
- databases:
- REDACTED
- REDACTED
name: REDACTED
options: SUPERUSER
databaseInitSQL:
name: REDACTED-db-init
key: REDACTED_init.sql
instances:
- name: instance1
replicas: 2
dataVolumeClaimSpec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: 500Gi`
Thanks for reporting the issue, we're looking forward to helping you!
Add a concise description of what the bug is.
Environment
Please provide the following details:
- Platform: Rancher K3S/AKS
- Platform Version: Rancher- v1.22.6+k3s1,
- PGO Image Tag: (e.g.
ubi8-5.1.0-0
) centos8-13.5-0 - Postgres Version (e.g.
14
) 13 - Storage: hostpath
Steps to Reproduce
- Create cluster with a single replica and a
users:
configuration as shown in the yaml I sent - Connect to postgres cluster and run
\du
- See that user isn't being created.
EXPECTED
- Users are being created normally.
ACTUAL
- Users arent created
hey @eliranw, what version of the operator are you using? Can you share the image tag from your operator deployment?
Closing this issue. Please reopen if you are still encountering this problem and would like further assistance.