Skip to content

PostgreSQL not starting up because of incorrect server.key permissions

Summary

PostgreSQL not starting up because of incorrect server.key permissions

Current Behaviour

PostgreSQL pod (patroni) doesn't start (probably because fsGroup forcing incorrect permissions)

Steps to reproduce

Delete any replica pod

Expected Behaviour

PostgreSQL pod (patroni) starts OK

Possible Solution

!1680 (closed)

Environment

  • StackGres version:

quay.io/stackgres/operator:1.16.1

  • Kubernetes version:

Server Version: v1.27.15

  • Cloud provider or hardware configuration:

Relevant logs and/or screenshots

2025-05-08 10:13:56,203 INFO: Lock owner: db-postgresql-cluster-meta-coord-0; I am db-postgresql-cluster-meta-coord-2
2025-05-08 10:13:56,213 INFO: Local timeline=1 lsn=0/30A1D50
2025-05-08 10:13:56,249 INFO: primary_timeline=1
2025-05-08 10:13:56,249 INFO: Lock owner: db-postgresql-cluster-meta-coord-0; I am db-postgresql-cluster-meta-coord-2
2025-05-08 10:13:56,249 INFO: starting as a secondary
2025-05-08 10:13:56 UTC [136103]: db=,user=,app=,client= FATAL:  private key file "server.key" has group or world access
2025-05-08 10:13:56 UTC [136103]: db=,user=,app=,client= DETAIL:  File must have permissions u=rw (0600) or less if owned by the database user, or permissions u=rw,g=r (0640) or less if owned by root.
2025-05-08 10:13:56 UTC [136103]: db=,user=,app=,client= LOG:  database system is shut down
2025-05-08 10:13:56,587 INFO: postmaster pid=136103
2025-05-08 10:14:01,386 INFO: establishing a new patroni heartbeat connection to postgres
2025-05-08 10:14:03,126 INFO: establishing a new patroni heartbeat connection to postgres
2025-05-08 10:14:03,127 WARNING: Retry got exception: connection problems
/var/run/postgresql:5432 - no response
2025-05-08 10:14:06,183 INFO: Lock owner: db-postgresql-cluster-meta-coord-0; I am db-postgresql-cluster-meta-coord-2
2025-05-08 10:14:06,183 INFO: failed to start postgres
Edited by Paul Smith