High Availability and Automatic Failover in PostgreSQL on Kubernetes, On-premise and Cloud
https://www.youtube.com/watch?v=97rwCskemXo&list=PLWhC0zeznqknTPmcSrKmnV75Zr3QLfq7e&index=28
HAProxy can be configured to check via Patroni api who is the new master after a switchover :
below picture is from above video at minute 26:23
Same ideea of a Load Balancer who uses health checks in order to find the master ==>>
