<p>I'm following this kubernetes tutorial to create a service <a href="https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#creating-a-service" rel="noreferrer">https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#creating-a-service</a></p>
<p>I'm using minikube on my local environment. Everything works fine but I cannot curl my cluster IP. I have an operation timeout:</p>
<pre class="lang-sh prettyprint-override"><code>curl: (7) Failed to connect to 10.105.7.117 port 80: Operation timed out
</code></pre>
<p>My <code>kubectl get svc</code></p>
<pre class="lang-sh prettyprint-override"><code>NAME           TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
kubernetes     ClusterIP      10.96.0.1       &lt;none&gt;        443/TCP        5d17h
my-nginx       ClusterIP      10.105.7.117    &lt;none&gt;        80/TCP         42h
</code></pre>
<p>It seems that I'm having the same issue that this guys here who did not find any answer to his problem: <a href="https://github.com/kubernetes/kubernetes/issues/86471" rel="noreferrer">https://github.com/kubernetes/kubernetes/issues/86471</a></p>
<p>I have tried to do the same on my gcloud console but I have the same result. I can only curl my external IP service.</p>
<p>If I understood well, I'm suppose to be already in my minikube local cluster when I start minikube, so for me I should be able to curl the service like it is mention in the tutorial.</p>
<p>What I'm doing wrong?</p>

<p>Although each Pod has a unique IP address, those IPs are not exposed outside the cluster without a Service. Services allow your applications to receive traffic. Services can be exposed in different ways by specifying a  <code>type</code>  in the ServiceSpec:</p>
<ul>
<li><strong><em>ClusterIP</em></strong>  (default) - Exposes the Service on an internal IP in the cluster. This type makes the Service only reachable from within the cluster. That is why you cannot access your service via ClusterIP from outside the cluster.</li>
<li><strong><em>NodePort</em></strong>  - Exposes the Service on the same port of each selected Node in the cluster using NAT. Makes a Service accessible from outside the cluster using  <code>&lt;NodeIP&gt;:&lt;NodePort&gt;</code>. Superset of ClusterIP.</li>
</ul>
<pre><code>kind: Service
apiVersion: v1
metadata:
  name: example
  namespace: example
spec:
  type: NodePort
  selector:
    app: example
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 8080
      name: ui
</code></pre>
<p>Then execute command:</p>
<pre><code>$ kubectl get svc --namespace=example

NAME               TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
jenkins-ui         NodePort    yy.zz.xx.xx     &lt;none&gt;        8080:30960/TCP   1d
</code></pre>
<p>Get  <code>minikube ip</code>  to get the nodeIP</p>
<pre><code>$ minikube ip
aa.bb.cc.dd
</code></pre>
<p>then you can curl it:</p>
<pre><code>curl http://aa.bb.cc.dd:8080
</code></pre>
<ul>
<li><strong><em>LoadBalancer</em></strong>  - Creates an external load balancer in the current cloud (if supported) and assigns a fixed, external IP to the Service. Superset of NodePort.</li>
</ul>
<pre><code>kind: Service
apiVersion: v1
metadata:
  name: example
spec:
  selector:
    app: example
  ports:
  - protocol: &quot;TCP&quot;
    port: 8080
    targetPort: 8080
  type: LoadBalancer
  externalIPs:
  - &lt;your minikube ip&gt;
</code></pre>
<p>then you can curl it:</p>
<pre><code>$ curl http://yourminikubeip:8080/
</code></pre>
<ul>
<li><strong><em>ExternalName</em></strong>  - Exposes the Service using an arbitrary name (specified by  <code>externalName</code>  in the spec) by returning a CNAME record with the name. No proxy is used. This type requires v1.7 or higher of  <code>kube-dns</code>. The service itself is only exposed within the cluster, however, the FQDN <code>external-name</code> is not handled or controlled by the cluster. This is likely a publicly accessible URL so you can curl from anywhere. You'll have to configure your domain in a way that restricts who can access it.</li>
</ul>
<p>The service type externalName is external to the cluster and really only allows for a CNAME redirect from within your cluster to an external path.</p>
<p>See more: <a href="https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/" rel="noreferrer">esposing-services-kubernetes</a>.</p>
