<p><strong>Background</strong><br>
I am testing the Kubernetes setting on <code>Minikube</code>. I have two simple services successfully setup and they are backed by simple docker image. Below is an example of my service configuration. I use <code>NodePort</code> to expose the service on port 80. </p>

<pre><code># service 1
kind: Service
apiVersion: v1
metadata:
  name: service1
spec:
  selector:
    app: service1
  ports:
  - name: http
    protocol: TCP
    port: 80
    targetPort: 8080
  type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: service1-deployment
  labels:
    app: service1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: service1
  template:
    metadata:
      labels:
        app: service1
    spec:
      containers:
      - name: service1
        image: service1
        imagePullPolicy: Never
        ports:
        - containerPort: 8080
---
# service 2
kind: Service
apiVersion: v1
metadata:
  name: service2
spec:
  selector:
    app: service2
  ports:
  - name: http
    protocol: TCP
    port: 80
    targetPort: 8080
  type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: service2-deployment
  labels:
    app: service2
spec:
  replicas: 1
  selector:
    matchLabels:
      app: service2
  template:
    metadata:
      labels:
        app: service2
    spec:
      containers:
      - name: service2
        image: service2
        imagePullPolicy: Never
        ports:
        - containerPort: 8080
</code></pre>

<p><strong>Issue</strong><br>
I use <code>docker exec -it</code> to go inside docker container. I can <code>curl service1</code> from <code>service2</code> container without any issue. However, if I try to <code>curl service2</code> from <code>service2</code> container, it gets a timeout connection error. </p>

<p>Results from <code>curl -v service2</code></p>

<blockquote>
  <p>Rebuilt URL to: service2/<br>
  Trying 10.101.116.46...<br>
  TCP_NODELAY set<br>
  connect to 10.101.116.46 port 80 failed: Connection timed out<br>
  Failed to connect to service2 port 80: Connection timed out<br>
  Closing connection 0<br>
  curl: (7) Failed to connect to service2 port 80: Connection timed out</p>
</blockquote>

<p>I guess the DNS records gets resolved correctly, because <code>10.101.116.46</code> is the correct IP attached to <code>service2</code>. Then what could be the issue cause this problem? </p>

<p><strong>More Followup Tests</strong><br>
From my understanding, the Kubernetes service internally maps the port to container port, so in my case it maps service port <code>80</code> to pod port <code>8080</code>. From <code>service2</code> container, I am able to <code>curl &lt;service2 pod ip&gt;:8080</code> successfully, but I am not able to <code>curl &lt;service2 ip&gt;</code>, which resolves connection time out error. And this happens exactly the same inside the <code>service1</code> container that it can access pod but no service. I do not understand is there any internal setting that I miss? </p>

<p>This could be any of these:</p>

<ul>
<li>The pod servicing service2 has a service that is listening on <code>127.0.0.1</code> or not listening on <code>0.0.0.0</code> (Any IP address)</li>
<li>service2 has a redirect and your service only listen on port <code>80</code>. You would have to enable the other port (possibly <code>443</code>) and run <code>curl</code> with the <code>-L</code> option to follow the link.</li>
<li>The pod servicing service2 is not even listening on port <code>80</code>.</li>
</ul>
