title: Cannot access a cluster IP from internally from another pod: Connection refused
body: <p>I'm using Docker Desktop Kubernetes on Windows, and I cannot access a ClusterIP service internally from another pod.
  This is what i deployed:</p>
  <p>$ k get pods -o wide</p>
  <p>my-nginx-deploy-d78b588bf-cffmd 1/1     Running   0  83s   10.1.0.123   docker-desktop</p>
  <p>my-nginx-deploy-d78b588bf-m945j 1/1     Running   0  83s   10.1.0.122   docker-desktop</p>
  <p>$ k get services -o wide</p>
  <p>nginx-service  ClusterIP   10.103.79.175            8818/TCP   22m   app=nginx</p>
  <p>I'm checking internal connectivity running a shell in one of the pods and sending a requesto to the service (by name and by IP) an directly to the pod:</p>
  <p>&amp; k exec -ti my-nginx-deploy-d78b588bf-cffmd -- /bin/sh</p>
  <blockquote>
  <blockquote>
  <p>curl nginx-service:8818</p>
  </blockquote>
  </blockquote>
  <pre><code>  curl: (7) Failed to connect to nginx-service port 8818 after 21031 ms: Connection refused
  </code></pre>
  <blockquote>
  <blockquote>
  <p>curl 10.103.79.175:8818</p>
  </blockquote>
  </blockquote>
  <pre><code>  curl: (7) Failed to connect to nginx-service port 8818 after 21031 ms: Connection refused
  </code></pre>
  <blockquote>
  <blockquote>
  <p>curl 10.1.0.122</p>
  </blockquote>
  </blockquote>
  <pre><code>  &lt;!DOCTYPE html&gt;
    &lt;html&gt;
    &lt;head&gt;
    &lt;title&gt;Welcome to nginx!&lt;/title&gt;
    ...
    &lt;/html&gt;
  </code></pre>
  <p>So the pod is running and can be accesed using the pod IP, but the service is rejecting connections.</p>
  <p>This is the yaml of the service:</p>
  <p>$ k get service nginx-service -o yaml</p>
  <p>apiVersion: v1<br/>
  kind: Service<br/>
  metadata:<br/>
  name: nginx-service<br/>
  spec:<br/>
  clusterIP: 10.103.79.175<br/>
  clusterIPs:<br/></p>
  <ul>
  <li>10.103.79.175<br/>
  internalTrafficPolicy: Cluster<br/>
  ipFamilies:<br/></li>
  <li>IPv4<br/>
  ipFamilyPolicy: SingleStack<br/>
  ports:<br/></li>
  <li>name: nginx-port<br/>
  port: 8818<br/>
  protocol: TCP<br/>
  targetPort: 80<br/>
  selector:<br/>
  app: nginx<br/>
  sessionAffinity: None<br/>
  type: ClusterIP<br/>
  status:<br/>
  loadBalancer: {}<br/></li>
  </ul>
  <p>What could be the reason? how can I dig into the problem?</p>