Connecting to multiple databases on Kubernetes

5/10/2018

I have a cluster with multiple databases. Applications on my cluster can access the database using the clusterIP service. For security reasons, I do not want to expose these databases publicly using a nodeport or a loadbalancer.

What I would like to do is upload a web based database client to Kubernetes and expose this client as a service, so that the database can be accessed.

Is something like this possible?

-- jdoe
database
database-connection
kubernetes

2 Answers

5/10/2018

You would need to check, in any registry, if there is this web based client Docker image you want. If there is, you would deploy it as pod, and will expose this pod to access from your browser.

-- suren
Source: StackOverflow

5/10/2018

Personal opinion aside on 'web based database client' and security concern

What you are trying to achieve seems to be proxying your databases through a web app.

This would go like this:

NodePort/LB --> [WebApp] --> (DB1 ClusterIP:Port)--[DB1]
                         \--> (DB2 ClusterIP:Port)--[DB2]
                          \--> (DB3 ClusterIP:Port)--[DB3]

You just have to define a NodePort/LB Service to expose your WebApp publicly, and ClusterIP Services for each Database you want to be able to reach. As long as the WebApp is running in the same cluster, it will be able to connect to your internal databases, while they wouldn't be directly reachable from outside the Kubernetes cluster.

-- Hiruma
Source: StackOverflow