How to connect my Rails Application localhost with replica-set postgres GPC

11/28/2019

Is it possible to establish connection from my localhost app to a replica-set postgres kubernetes? or what solution I need to do for having a mirror of my production database?

Thanks in advance

-- Jonathan Raul Reyes Toledo
google-cloud-platform
kubernetes

1 Answer

11/28/2019

What you need is a so-called PostgreSQL Kubernetes operator that will be responsible for building Kubernetes objects based on your requests.

You can have a look at OperatorHub.io, they have some PostgreSQL operators.

Maybe an easier solution is KubeDB and the KubeDB PostgreSQL implementation.

The operator will also create a Kubernetes Service that will create a resolvable name linked to the Kubernetes Pods of your PostgreSQL cluster. KubeDB doc explains how to connect to the database in their documentation.

Now coming to your question :

Is it possible to establish connection from my localhost app [...]

You can access the Kubernetes service from outside but you will have to create a Kubernetes Load Balancer. See this blog article which explains it in details.

-- ZedTuX
Source: StackOverflow