<p>I'm running a deployment with three nginx pods and a service but when I try to connect to the service cluster-IP it doesn't connect.  Below are my YAML files and kubectl commands.</p>
<p>nginx-deployment:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 3
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80
</code></pre>
<p>nginx-service:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: nginx
  labels:
    app: nginx
spec:
  selector:
    app: nginx
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80


ubuntu@k8s-t2-cp:~/nginx$ kubectl get pods -o wide
NAME                               READY   STATUS    RESTARTS   AGE   IP               NODE              NOMINATED NODE   READINESS GATES
nginx-deployment-55f598f8d-6d25c   1/1     Running   0          23m   192.168.26.152   ip-172-30-1-183   &lt;none&gt;           &lt;none&gt;
nginx-deployment-55f598f8d-6j92r   1/1     Running   0          23m   192.168.26.151   ip-172-30-1-183   &lt;none&gt;           &lt;none&gt;
nginx-deployment-55f598f8d-rhpwv   1/1     Running   0          23m   192.168.26.150   ip-172-30-1-183   &lt;none&gt;           &lt;none&gt;


ubuntu@k8s-t2-cp:~/nginx$ kubectl get services
NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.96.0.1       &lt;none&gt;        443/TCP   125m
nginx        ClusterIP   10.106.154.85   &lt;none&gt;        80/TCP    23m
</code></pre>
<p><strong>The curl command just hangs:</strong></p>
<p>ubuntu@k8s-t2-cp:~/nginx$ curl 10.106.154.85</p>

Philoxopher
<p>ClusterIP is not for external access as I can see you are using the curl command from your Ubuntu machine. ClusterIP is only accessible inside the namespace on the pod level. If you want to check if the service is working or not without shifting service type you can do as follow.</p>
<p>Exec into any nginx pod by using this command <code>kubectl exec -it my-pod -- /bin/bash</code> In your case it will be like that <code>kubectl exec -it nginx-deployment-55f598f8d-6d25c -- /bin/bash</code> Now you will be inside of pod and curl command should work.
You may have to install curl manually depending upon which Linux image is used by your pods.</p>
<p>Another way to test your services is to convert your ClusterIP into nodePort or Loadbalancer.</p>
