<p>When we spin up a cluster with kubeadm in kubernetes, and the service's <code>.yaml</code> file looks like this :</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: neo4j
  labels:
    app: neo4j
    component: core
spec:
  clusterIP: None
  ports:
    - port: 7474
      targetPort: 7474
      name: browser
    - port: 6362
      targetPort: 6362
      name: backup
  selector:
    app: neo4j
    component: core
</code></pre>

<p>After all pods and services run, I do <code>kubectl proxy</code> and it says :</p>

<pre><code>Starting to serve on 127.0.0.1:8001
</code></pre>

<p>So when I want to access to this service like :</p>

<pre><code>curl localhost:8001/api/
</code></pre>

<p>it's just reachable inside the cluster! How can I reach to services outside the cluster?</p>

Majid Rajabi
<p>You should expose your service using NodePort:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: neo4j
  labels:
    app: neo4j
    component: core
spec:
  externalTrafficPolicy: Local
  type: NodePort
  ports:
    - port: 7474
      targetPort: 7474
      name: browser
    - port: 6362
      targetPort: 6362
      name: backup
  selector:
    app: neo4j
    component: core
</code></pre>

<p>Now if you describe your service using </p>

<pre><code> kubectl describe svc neo4j
</code></pre>

<p>You will get a nodeport value which will be in between 30000-32767 and you can access your service from outside the cluster using</p>

<pre><code>curl http://&lt;node_ip&gt;:&lt;node_port&gt;
</code></pre>

<p>Hope this helps.</p>

<p>EDIT: Yes you can't directly use <code>clusterIP: None</code> in case of exposing service through NodePort. Now <code>clusterIP: None</code> means there is no internal load balancing done by kubernetes and for that we can also use <code>externalTrafficPolicy=Local</code> in service definition. </p>

<p>Alternatively, you might be able to use an ingress to route traffic to the correct Service.</p>
