Is it possible to connect pgsql running in Kubernetes cluster using clients like Dbeaver or SQLDeveloper outside of cluster?

8/8/2021

i am trying to connect dbeaver from outside the cluster but it seems i can't establish the connection with the pgsql, have tried port forwarding in kubernetes but still it didn't solved the problem, just point which all things i should check?

Edit1: kubernetes in running in remote ubuntu box and am dbeaver is in my machine which is having a different ip address? kubernetes is not running on my machine.

-- marco525
dbeaver
kubernetes
postgresql

1 Answer

8/10/2021

Yes, it's possible. Thanks @Turing85 and @AndD.

My postgres pod is running in Kubernetes cluster eg.(IP:192.168.0.1).

  1. Logged into the cluster and fired this command:

    kubectl get services

  2. After getting services fired below command to map external ip to my service, i have exposed it to same ip where cluster is running.

kubectl patch svc backend -p '{"spec":{"externalIPs":["192.168.0.1"]}}'

detailed example: https://stackoverflow.com/questions/44519980/assign-external-ip-to-a-kubernetes-service

  1. After that just provided connection settings(ip,dbusername,dbname,passowrd,port) in dbeaver and it worked.
-- marco525
Source: StackOverflow