I have an Openshift Origin 3.* cluster up an running. It works great, and I have a few applications running there, composed of their own app server, database server, and ldap server Openshift services/deployments/pods.
These web applications are exposed via the HA2-router. All of this works nicely, and we can access the webapps using the Openshift Routes we set up via the HA2-router. However, we'd like to to get access to the Postgresql database services running in Openshift with tools like 'psql' (a command line Postgresql client), or PgAdmin (a GUI that connects to Postgresql).
I'm stumped as to how to accomplish this. Services or pods within Openshift have no trouble connecting to the Postgresql pods -- because they Openshift performs its own DNS and routing between those pods. However, the only way I'm familiar with that communication can happen from the outside is via a router like HA2-router. This doesn't work, because the HA2-router exposes services in Postgresql via HTTP... We need to connect to a Postgresql pod via TCP, on port 5432.
Thanks.
You can use
In order to take full advantage of the “rhc port-forward” tool, make sure that you have the latest version of the client tools. On systems with the client tools installed via ruby gem, enter the following command:
Step 2
Now that you have the latest client tools installed, you should have access to the “rhc port-forward” command. Once the command is invoked, the client tools will scan your deployed application and look for any embedded services available to forward. The client tools will then configure your local system to be able to connect to the available services for your remote application.
Step 3
You can see the command has now mapped port 5432 in the application to port 5432 on the local machine. You can now connect to the local loopback address (127.0.0.1) on port 5433 to connect to PostgreSQL running on the gear.
or can connect to pgadmin tool too.
You can visit the link for further clarifications
https://blog.openshift.com/getting-started-with-port-forwarding-on-openshift/ https://developers.openshift.com/managing-your-applications/port-forwarding.html https://docs.openshift.com/enterprise/3.0/dev_guide/port_forwarding.html