<p>I am new to Kubernetes and I am trying to create a simple front-end back-end application where front-end and back-end will have its own services. For some reason, I am not able to access back-end service by its name from front-end service.</p>

<p>Just because of simplicity, front-end service can be created like:<br/>
<code>kubectl run curl --image=radial/busyboxplus:curl -i --tty</code></p>

<p>When I do a nslookup I get the following:<br/></p>

<pre><code>[ root@curl-66bdcf564-rbx2k:/ ]$ nslookup msgnc-travel
Server:    10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

Name:      msgnc-travel
Address 1: 10.100.171.209 msgnc-travel.default.svc.cluster.local

</code></pre>

<p>Service is available by its name msgnc-travel, but when I try to do curl it:<br/>
<code>curl msgnc-travel</code><br/>
it just keeps on waiting and no response is received. I have also tried  <br/>
<code>curl 10.100.171.209</code> and <code>curl msgnc-travel.default.svc.cluster.local</code> but I have the same behaviour
<br/><br/></p>

<p>Any ideas why is this issue occurring? <br/></p>

<p>I have successfully managed to do a "workaround" by using Ingress, but I am curious why can't I access my Spring Boot backend service directly just by providing its name?</p>

<p><strong>deployment.yml</strong> looks like this:</p>

<pre><code>apiVersion: apps/v1

kind: Deployment

metadata:
  name: msgnc-travel-deployment
  labels:
    name: msgnc-travel-deployment
    app: msgnc-travel-app

spec:
  template:
    metadata:
      name: msgnc-travel-pod
      labels:
        name: msgnc-travel-pod
        app: msgnc-travel-app

    spec:
      containers:
        - name: msgnc-travel
          image: bdjordjevic/msgnc-travel
          ports:
            - containerPort: 8080
  replicas: 1
  selector:
    matchExpressions:
      - {key: name, operator: In, values: [msgnc-travel-pod]}
      - {key: app, operator: In, values: [msgnc-travel-app]}

</code></pre>

<p><strong>service.yml</strong> looks like this:</p>

<pre><code>apiVersion: v1

kind: Service

metadata:
  name: msgnc-travel
  labels:
    name: msgnc-travel-service
    app: msgnc-travel-app

spec:
  ports:
    - port: 8080
      targetPort: 8080
  selector:
    name: msgnc-travel-pod
    app: msgnc-travel-app

</code></pre>

Boban Djordjevic
<p>You are defining the service to listen at port 8080. So you are supposed to execute <code>curl msgnc-travel:8080</code>.</p>

<p>I tried running wget and this is the output I got:</p>

<pre class="lang-sh prettyprint-override"><code>wget msgnc-travel:8080
Connecting to msgnc-travel:8080 (10.98.81.45:8080)
wget: server returned error: HTTP/1.1 404 
</code></pre>
