Hacker News new | ask | show | jobs
by CyberDem0n 3116 days ago
It looks like you are talking here about postgres-operator by Crunchy

Yeah, crunchy was a little faster with releasing it than Zalando, but try you look closer how they deploy postgres on kubernetes. Somehow it feels that they are trying to map 1 to 1 the same approach how folks used to run postgres on bare metal. That is: deploy master pod, wait until it's up and running, deploy a replica pod, and so on...

It doesn't really look cloud-k8s-native.

In my opinion such deployment should look absolutely different. You just need to deploy k8s manifest, which will create Secrets, StatefulSet and Service which will be used to connect to the master. The rest should happen automatically: * StatefulSet will start N pods with postgres * pods (Patroni) will elect leader. * elected leader will initialize (initdb) a new cluster * all other pods will get basebackup from the leader and become replicas * if the master(leader) pod die - other pods will elect a new leader * StatefulSet will start a replacement of failing pod and it will join the cluster as a new replica

And more important all it should happen without connection to Etcd, ZooKeeper or Consul. It should just use Kubernetes API.

Basically all this "magic" is already supported by Patroni https://github.com/zalando/patroni/pull/500

We are planning to merge this PR today or tomorrow, and it will make Patroni+PostgreSQL first class citizen on Kubernetes.

1 comments

Thanks for the detailed reply. I see your PR has been merged. The StatefulSet support does look great. Are there any advantages over the CrunchyDB StatefulSet setup here: https://github.com/CrunchyData/crunchy-containers/tree/maste...?