<p>I got the following service defined: </p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: customerservice
spec:
  type: NodePort
  selector:
    app: customerapp
  ports:
  - protocol: TCP
    port: 31004
    nodePort: 31004
    targetPort: 8080
</code></pre>

<p>Current situation: I am able to hit the pod via the service IP.
Now my goal is to reach the <code>customerservice</code> via the name of the service, which does not work right now. So I would simply type <code>http://customerservice:31004</code> instead of <code>http://&lt;IP&gt;:31004</code>.</p>

elp
<p>DNS resolution of services is ONLY available within the cluster, provided by CoreDNS/KubeDNS.</p>

<p>Should you wish to have access to this locally on your machine, you'd need to use another tool. One such tool is <code>kubefwd</code>:</p>

<p><a href="https://github.com/txn2/kubefwd" rel="nofollow noreferrer">https://github.com/txn2/kubefwd</a></p>

<p>A slightly simpler solution, is to use port-forward; which is a very simple way to access a single service locally.</p>

<p><code>kubectl port-forward --namespace=whatever svs/service-name port</code></p>

<p>EDIT:// I've made the assumption that you want to use the service DNS locally, as I'm assuming by saying:</p>

<blockquote>
  <p>I would simply type <a href="http://customerservice:31004" rel="nofollow noreferrer">http://customerservice:31004</a></p>
</blockquote>

<p>is in the context of your web browser.</p>
