<p><a href="https://i.stack.imgur.com/EjxHn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EjxHn.png" alt=") "></a></p>

<p>I want to connect to my <code>Postgres DB</code> . I use deployment <code>NodePort</code> IP for the host field and also data from config file :</p>

<pre><code>data:
  POSTGRES_DB: postgresdb
  POSTGRES_PASSWORD: my_password
  POSTGRES_USER: postgresadmin
</code></pre>

<p><a href="https://i.stack.imgur.com/nHT2w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nHT2w.png" alt="enter image description here"></a></p>

<p>But I get error . What do I do wrong ? If you need more info - let me know .</p>

Andrey Radkevich
<p>Unless you are connected to your cluster through VPN (or direct connect), you can't access 10.121.8.109. It's a private IP address and only available for apps and services within you VPC.</p>

<p>You need to create public access for your node port service. Try <code>kubectl get service</code> to find out the External IP for your service. Then try to connect to your IP address from External IP.</p>

<p>Rather than using NodePort service, you are better off using Load Balancer type service which might give you better flexibility in managing this especially in a production env. But it will cost a little more Likelihood of an IP Address to change is high, but load balancer or ingress service would automatically manage this for you through a fixed DNS. So you need to weigh the pros and cons of using service type based on your workload.</p>
