I'm trying to build a custom postgres master and slave setup in Kubernetes.
However, as part of streaming configuration of the master I have to register the slave's IP address.
echo "host replication replica $IP_SLAVE/24 md5" >> /etc/postgresql/${VERSION}/main/pg_hba.conf
Where the $IP_SLAVE
is the ip address of the slave pods.
Likewise, on slave
pg_basebackup -h ${MASTER_HOST} -D /var/lib/postgresql/${VERSION}/main -U replica -v -P
where the $MASTER_HOST
is the ip address of the master pod.
This is to say for every newly created slave replica the master should always receive the ip address of those slave replica pods.
I'm new to kubernetes and would like to find a away, how I could do it in a programming manner if possible. If not, just want to find out the ways in doing such.
Reason why I'm doing this is because the existing solutions for such setup are not compatible with ARM kubernetes cluster devices such as helm from bitnami and kubedb.
Or if there is an existing solution compatible with ARM I would more than happy to know it.