zalando / zalando/postgres-operator

Postgres-operator severed from cluster by changing `postgres.*.credentials` secret

Open
#524 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
5.2k
Forks
1.1k
Avg merge
2d 16h
Merged PRs (30d)
3

Description

Hi,

Changing postgres user password by modifying Kubernetes postgres.*.credentials Secret causes error in postgres-operator:

time="2019-03-27T18:51:01Z" level=warning msg="error while syncing cluster state: could not sync roles: could not init db connection: could not init db connection: pq: password authentication failed for user \"postgres\"" cluster-name=postgres-operator-pg-test/infra-postgres-operator-test-patroni pkg=cluster
time="2019-03-27T18:51:01Z" level=error msg="could not sync cluster: could not sync roles: could not init db connection: could not init db connection: pq: password authentication failed for user \"postgres\"" cluster-name=postgres-operator-pg-test/infra-postgres-operator-test-patroni pkg=controller worker=0

The postgres-operator cannot connect to the Postgres because it's trying to use the new password (from Secret) and fails.

Possible solutions:

  • port-forward so the connection will be authenticated by using trusted IP address in pg_hba.conf
  • extend Patroni REST API to be able to change superuser password after initialisation
  • exec into master spilo Pod and run psql from there (yuk!)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the cluster sync and role-connection path described in the error, then inspect how the Kubernetes credentials Secret is consumed. Compare the listed port-forward, Patroni REST API, and Spilo Pod approaches. Done means changing the postgres password no longer prevents the operator from reconnecting and syncing roles.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes, postgresql
Domain
databases, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.