<p>I'm trying to communicate a service from other Pod, but i'm unable to access on it.</p>

<p>Im using GKE, I tried different ports and setups and looking into the code: <a href="https://github.com/spreaker/prometheus-pgbouncer-exporter" rel="nofollow noreferrer">https://github.com/spreaker/prometheus-pgbouncer-exporter</a></p>

<p>My deployment file, has:</p>

<pre><code>spec:
    containers:
        - name: exporter
          image: ...
          ports:
          - containerPort: 9127
          env:
             ...
</code></pre>

<p>And the service:</p>

<pre><code>type: NodePort
  ports:
    - port: 9127
      protocol: "TCP"
      name: exporter
</code></pre>

<p>When I try to describe the svc:</p>

<pre><code>Name:                     ...-pg-bouncer-exporter-service
Namespace:                backend
Labels:                   app=...-pg-bouncer-exporter
Annotations:              &lt;none&gt;
Selector:                 app=...-pg-bouncer-exporter
Type:                     NodePort
IP:                       10.0.19.80
Port:                     exporter  9127/TCP
TargetPort:               9127/TCP
NodePort:                 exporter  31296/TCP
Endpoints:                10.36.7.40:9127
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   &lt;none&gt;
</code></pre>

<p>And the Pod itself:</p>

<pre><code>Containers:
  exporter:
    Container ID:   docker://...
    Image:          ...
    Image ID:       docker-pullable:...
    Port:           9127/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Wed, 10 Jul 2019 11:17:38 +0200
    Ready:          True
    Restart Count:  0
</code></pre>

<p>If I access to the container, I'm receiving correctly data from curl:</p>

<pre><code>/ # curl localhost:9127/metrics
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes ....
</code></pre>

<p>Also doing a port-forward to the service it works:</p>

<pre><code>$ kubectl port-forward services/...-pg-bouncer-exporter-service 9127:9127 -n backend
Forwarding from 127.0.0.1:9127 -&gt; 9127
Forwarding from [::1]:9127 -&gt; 9127
Handling connection for 9127
</code></pre>

<p>Now im getting this error from other pod in the same network:</p>

<pre><code>curl 10.36.7.40:9127/metrics
curl: (7) Failed to connect to 10.36.7.40 port 9127: Connection refused
</code></pre>

<p>Also If I create a LivenessProbe TCP to the 9127, im getting this error:</p>

<pre><code>Liveness probe failed: dial tcp 10.36.7.40:9127: connect: connection refused
</code></pre>

<p>I don't see what im doing wrong, im using the same setup for other services.</p>

<p>Thanks in advance!</p>

murb83
<p>So the problem was:</p>

<p>Instead to use <code>127.0.0.1</code> for the PGBOUNCER_EXPORTER_HOST i have to use <code>0.0.0.0</code>.</p>

<p>Thats solves the issue.</p>
