Kubernetes: How to connect to a postgresql database in k8s from local vm through jdbc

9/19/2019

How can i connect to a postgresql server deployed in K8S cluster from my local VM?Intead to getting inside the pod which runs the DB, I wanted to access it using jdbc.I have created an ingress for the pod which runs the pgserver.Will it be possible to access using a jdbc url created with the ingress hostname?

-- anisha Ks
kubernetes

2 Answers

9/19/2019

Yes it is possible with ingress hostname or port-forward postgres SVC, access the same in JDBC

-- Madhu Potana
Source: StackOverflow

9/19/2019

Yes you can do it.Use the ingress as hostname and port for database using JDBS further you can make the connection with database server.

jdbc:postgresql://<database_host>:<port>/<database_name>
-- Harsh Manvar
Source: StackOverflow