Connecting to a containerised PostgreSQL running in a GKE cluster

Hi!

I'm new to GKE so sorry if this is a very "beginner's" question!

I recently deployed a workload to the cluster containing a containerised PostgreSQL database. 

The pod has an identifier (of course) but I'm not sure how to go about provisioning a service for it so that it can be directly connected to (for maintenance, etc) from outside of the VPC. Ideally I would expose a connection to its IP with the usual port (ie 5432). 

Is this possible?

4 2 84
2 REPLIES 2

Hi @danielrosehill ,

You can simply expose the database microservice with a Service object on the default port "5432" and then access to it from the same VPC using the NodePort, or from the outside using a Load Balancer Service Type. Consider that this is not the best way to access in a secure manner to the database, but you can manage to expose it only when you need it and not always. You can also consider to use an Ingress Controller and then manage the traffic using the Ingress resource (as the rules that you previously integrated in the service).

Let me know if you need more specific help!

Thanks so much! I did all that but haven't managed to achieve connectivity so I'm guessing perhaps a firewall issue (although I checked that too and as expected creating the service created an allow rule). Have reached out to GCP support but ... thanks for setting out the required steps!

Top Labels in this Space