0

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.

mkorbi
  • 237
  • 2
  • 12
Jayson Gonzaga
  • 140
  • 1
  • 4
  • 11
  • Try a statefulset and use the name of slave instead of IP , as it can be controlled. – Tarun Khosla Jul 31 '20 at 05:38
  • the approach i'm thinking is somewhat simillar to that.. but i'm going to use configmap.. so when a new pod is created that pod will update the config map to include it's ip address.. because that same config map will be used by other pods as well – Jayson Gonzaga Jul 31 '20 at 16:03

0 Answers0