Is the managed cluster on DO can connect with Managed Database PostgreSQL database cluster by default ?

July 17, 2019 398 views
DigitalOcean Kubernetes PostgreSQL

I try to create a deployment to create a pod that will need a database to interact with.
I configured a service with endpoints in the cluster to allow my pod to connect to Managed Database cluster in DO. When the pod created.It show error logs:

failed to open connection to database: pq: no pg_hba.conf entry for host "x.x.x.x", user "doadmin", database "testdb", SSL off\n"

As I guess that database cluster need to have a config to allow x.x.x.x (which I think it’s K8s cluster’s IP in DO).

Is there any confirmation that we don’t need additional setting on our K8s on DO and Managed Database PostgreSQL to allow those 2 can interact with each other as those was created with the same DO account.

3 Answers

You can configure does in the GUI of the managed databases, before the DB was publicly available and you could configure to specify ip ranges or droplets/networks within DO, they launched a internal network only, not sure if they now have this as default. This configurations are available in the GUI of DO and you can look at what you have configured.

Hi there!

You should ensure that you add the DOKS cluster as a Trusted Source (In cloud: go to the cluster –> Settings –> Edit Trusted Sources)

After that you should be able to connect to your database.

Regards,

John Kwiatkoski
Senior Developer Support Engineer

I seem to be having the same issue. I’m attempting to connect from my DOKS cluster to my DOPostgreSQL using the private network.

The error returned is the same as the original that was posted. The IP listed is the internal-ip for one of the nodes.

I can confirm that I have the cluster and the cluster added under Trusted sources.

Update: Not sure what the issue was but I created a new user view the DO GUI and logged in with that and it seems to be working now.

Have another answer? Share your knowledge.