<p>I have a Kubernetes (v1.18.6) with 1 service (loadbalancer), 2 pods in a development:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: app-service
spec:
  selector:
    app: app
  ports:
  - protocol: &quot;TCP&quot;
    port: 6000
    targetPort: 5000
  type: LoadBalancer
</code></pre>
<p>A network policy to access Internet (it is necessary for me):</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: internet-access
spec:
  podSelector:
    matchLabels:
      networking/allow-internet-access: &quot;true&quot;
  policyTypes:
  - Ingress
  - Egress
  ingress:
  - {}
</code></pre>
<p>Deployment config file</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: app-deployment
spec:
  progressDeadlineSeconds: 120
  selector:
    matchLabels:
      app: app
  replicas: 2
  template:
    metadata:
      labels:
        app: app
    spec:
      imagePullSecrets:
        - name: myregistrykey
      containers:
      - name: app
        image: app
        imagePullPolicy: Always
        ports:
        - containerPort: 5000
</code></pre>
<p>It is working correctly. But now, I want to connect this imagen to an external database (in another network only access by internet). For this proposition I use this service:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: postgresql
spec:
  clusterIP: None
  ports:
  - port: 25060


---
apiVersion: v1
kind: Endpoints
metadata:
  name: postgresql
subsets:
  - addresses:
        - ip: 206............
    ports:
      - port: 25060
        name: postgresql
</code></pre>
<p>It is all the services:</p>
<pre><code>NAME                TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)          AGE
app-service         LoadBalancer   10.245.134.137   206...........   6000:31726/TCP   2d4h
kubernetes          ClusterIP      10.245.0.1       &lt;none&gt;           443/TCP          3d7h
postgresql          ClusterIP      None             &lt;none&gt;           25060/TCP        19h
</code></pre>
<p>But when I try to connect I receive a timeout error of the database, like can't connect to the database.</p>
<p>I have an internet connection in the image.</p>
<p><strong>I find the solution, the problem was the rules of inbound of the database. I must add the IP of Kubernetes.</strong></p>
<p>Thx.</p>

<p>Here is what worked for me:</p>
<p>Define a service , but set <code>clusterIP: None</code> , so no endpooint is created.</p>
<p>And then create an endpoint yourself with the SAME NAME as your service and set the IP and port of your db.</p>
<p>In your example , you have a type in your endpoint: the name of your endpoint is postgresql not postgresSql.</p>
<p>My example:</p>
<pre><code>---
service.yaml
kind: Service
apiVersion: v1
metadata:
  name: backend-mobile-db-service
spec:
  clusterIP: None
  ports:
  - port: 5984
---
kind: Endpoints
apiVersion: v1
metadata:
  name: backend-mobile-db-service
subsets:
  - addresses:
        - ip: 192.168.1.50
    ports:
      - port: 5984
        name: backend-mobile-db-service

</code></pre>
