Question: Support for more than 1 replica of postgres-operator pod
- Which image of the operator are you using? v1.6.3
- Where do you run it - cloud or metal? Kubernetes or OpenShift? GCP GKE
- Are you running Postgres Operator in production? Yes
- Type of issue? Question
Question: Is it supported to run more than 1 replica of postgres-operator pod ?
It is not explicitly indicated in the documentation and the postgres-operator deployment has a default value of 1 (replicas) https://github.com/zalando/postgres-operator/blob/master/manifests/postgres-operator.yaml#L8
In case the only postgres-operator pod dies or is temporarily unavailable in the network then the master restarts after few short timeouts (error that the API cannot be contacted) which could be avoided (or at least partially mitigated) by having multiple replicas of postgres-operator pod
Thanks
I think, I have never tried to scale out operator pods - only scaled vertically with deployment resources. If the operator is down for a few seconds, it does not affect your Postgres clusters. We go with 1 operator pod in prod and do not run into problems of user requests being ignored. What problems are you facing?
Hi @FxKu Thanks for the insights, While re-reading again my logs I noticed that I had the following below that for some reason made me think the master couldn't talk with the API (or Patroni ?) for a short period and re-elected itself (with connection drop)
Now I've checked again the docs but not sure it is possible to customize this specific timeout for a few seconds more
Thanks
2021-11-14 04:53:42,440 INFO: Lock owner: acid-prod-postgres-1; I am acid-prod-postgres-1
2021-11-14 04:53:47,449 ERROR: Request to server https://10.60.0.1:443 failed: ReadTimeoutError
("HTTPSConnectionPool(host='10.60.0.1', port=443): Read timed out. (read timeout=4.999804334715009)",)
2021-11-14 04:53:47,850 INFO: no action. i am the leader with the lock
2021-11-14 04:53:52,781 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=0, status=None))
after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='10.60.0.1', port=443): Read
timed out. (read timeout=4.994452896527946)",)':
/api/v1/namespaces/zpgprod/pods?labelSelector=application%3Dspilo%2Ccluster-name%3Dacid-prod-postgres
2021-11-14 04:53:52,795 INFO: Lock owner: acid-prod-postgres-1; I am acid-prod-postgres-1
2021-11-14 04:53:52,804 WARNING: Concurrent update of acid-prod-postgres
2021-11-14 04:53:53,805 ERROR: failed to update leader lock
2021-11-14 04:54:03.513 38 LOG {ticks: 0, maint: 0, retry: 0}
2021-11-14 04:54:11,321 INFO: demoted self because failed to update leader lock in DCS
2021-11-14 04:54:11,323 WARNING: Loop time exceeded, rescheduling immediately.
2021-11-14 04:54:11,323 INFO: Lock owner: acid-prod-postgres-1; I am acid-prod-postgres-1
2021-11-14 04:54:11,324 INFO: closed patroni connection to the postgresql cluster
2021-11-14 04:54:11,395 INFO: updated leader lock during starting after demotion
2021-11-14 04:54:11,775 INFO: postmaster pid=4146499
/var/run/postgresql:5432 - no response
(...)
Looks like Patroni could not temporarily reach your DCS (K8s API or etcd). Probably a network issue and not related to Patroni/operator.
Thanks for the analysis, I'll review on my side