postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

Single ingress for database cluster

Open boopathykpm opened this issue 5 years ago • 2 comments

Hi Everyone,

Currently, I see the option to add LB for master and replicas separately, I have a use case where I need to expose a single endpoint for both read/write operations and it would be great if you have a mechanism that sends Reads to Replicas and Writes to Master.

I don't think single LB for a cluster is available currently.

boopathykpm avatar Feb 04 '20 07:02 boopathykpm

In PostgreSQL the SELECT query could call volatile function and therefore execute a transaction.

  1. It is not possible to figure out whether the specific SELECT is safe to execute on the replica without parsing it. Parsing usually is quite an expensive operation.
  2. The SELECT executed on the replica can return not up-to-date results unless it is executed on the specially configured synchronous replica.
  3. Usually applications are absolutely unprepared to deal with the stale data.

Only the application knows what query it is safe to execute on the replica and should do it explicitly by connecting to the replica service.

CyberDem0n avatar Feb 05 '20 09:02 CyberDem0n

@CyberDem0n It makes sense.

Can I use an Ingress for the PostgreSQL database, for example, I have an Ingress controller placed on the cluster and I wanted to use the existing Loadbalancer to connect to the database. Can we add Ingress support? Instead of enabling the load balancer for Master and Replicas separately

Does it make sense to implement the above requirement?

boopathykpm avatar Feb 05 '20 10:02 boopathykpm