<p>I Have a problem on Connect from Port Forwarding Database on Openshift :</p>
<p>Running Pods Postgresql :
<a href="https://i.stack.imgur.com/J5yuF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/J5yuF.png" alt="Postgresql Pods have Been Running" /></a>
<a href="https://i.stack.imgur.com/50yYE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/50yYE.png" alt="Detail Pods Postgresql" /></a></p>
<p>I Try Connect to Container running the database to check process and psql command, then it works :
<a href="https://i.stack.imgur.com/bck4h.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bck4h.png" alt="Connect inside container postgre" /></a></p>
<p>Next, I Try Port Forwarding for Try Connection from outside Openshift Cluster:
<a href="https://i.stack.imgur.com/qMfLE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qMfLE.png" alt="Run port forwarding postgresql" /></a></p>
<p>Then I Try Connect from Outside Cluster to connect Postgresql have Error: Connection Refuse
Im Using IP Based or Hostname / FQDN Not Working and Error Still Exist
<a href="https://i.stack.imgur.com/0EFmB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0EFmB.png" alt="Error Try Connect Postgresql to Openshift" /></a></p>
<p>And When I Try Check Firewall port it has been opened port 5432/TCP :
<a href="https://i.stack.imgur.com/ms2mI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ms2mI.png" alt="Check Ports Has Been Open or Not" /></a></p>
<hr />
<p>Anyone Can Help Me With This problem ?
Thanks</p>
<p>Note: Before I have Been Looking Documentation but Not Working Resolve the Problem
Source Documentation:
<a href="https://www.openshift.com/blog/openshift-connecting-database-using-port-forwarding" rel="nofollow noreferrer">https://www.openshift.com/blog/openshift-connecting-database-using-port-forwarding</a></p>
<p><a href="https://stackoverflow.com/questions/32439167/psql-could-not-connect-to-server-connection-refused-error-when-connecting-to">&quot;psql: could not connect to server: Connection refused&quot; Error when connecting to remote database</a></p>

<p>The <code>oc port-forward</code> command is forwarding from only your loopback interfaces.</p>
<p>If you are running your client on the same machine where the cluster is running, then use <code>localhost</code> as your &quot;Host&quot;.</p>
<p>If you are running your client on a different machine, they you need more network redirection to get this to work.  Please see this post for more information as well as work-arounds for your problem:  <a href="https://stackoverflow.com/questions/52607821/access-openshift-forwarded-ports-from-remote-host">Access OpenShift forwarded ports from remote host</a></p>
