I'm trying to run a basic highly available PostgreSQL cluster with Spilo images on a Docker Swarm setup, but every few days it starts failing in multiple ways: DNS resolution errors, connection timeouts, and corruption or inconsistency involving WAL data and etcd records. I can't afford a managed hosting solution right now. Has anyone experienced this kind of instability and found a reliable fix? It feels surprisingly difficult compared with setting up MariaDB with Galera, even though the goal seems fairly similar.
2 Answers
A PostgreSQL operator such as CloudNativePG on Kubernetes handles a lot of the discovery, failover, and recovery details for you, so it may be a more robust route if you can support that infrastructure.
I’ve run the sample Spilo setup on a three-node cluster without seeing those failures. One important difference is that I avoided service DNS entirely and configured the nodes with fixed IP addresses through Ansible. That may be worth testing, since unstable name resolution can cause cascading problems for the cluster.

I understand the appeal, but taking on Kubernetes right now would be far more complexity than I want for this deployment. I’m specifically trying to keep it within Docker Swarm.