<p>I am new to kubernetes so I apologize if I have skipped some obvious steps or am not clear with my question.</p>
<p>I have defined a service <code>game-app-service</code> and a deployment <code>game-app-deployment</code>. Both of these are up and running fine.</p>
<p>I am trying to route requests from an API Gateway service (Ambassador) to this service. When trying to curl a game-app-service endpoint from the Ambassador pod, I have discovered that I always receive empty replies and it connects to an IP that is not the service ip. However, if I swap out <code>game-app-service</code> with the ip address of the service and the port it is listening on:</p>
<p><code>curl -v -X POST 10.102.142.157:8084/api/test</code></p>
<p>Everything works correctly and I get the expected response from the server.</p>
<p>Something I noticed is <code>curl -v -X POST game-app-service/api/test</code> resolves to the same IP as <code>curl -v -X POST random/api/test</code>– 92.242.140.21 port 80. This leads me to believe that something is wrong with my DNS resolution. However, I have verified that my core-dns pods are up and running, so I am not sure why that might be.</p>
<p>Below, I have listed my configs for my service and deployment for reference:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: game-app-service
spec:
  selector:
    app: game-app-deployment
  ports:
    - protocol: TCP
      port: 8084
      targetPort: 8084
</code></pre>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: game-app-deployment
  labels:
    app: game-app-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: game-app-deployment
  template:
    metadata:
      labels:
        app: game-app-deployment
    spec:
      containers:
      - name: game-service-app
        image: weflop/game-service-app
        imagePullPolicy: Never
        ports:
        - containerPort: 8084
</code></pre>
<p>Does anyone have any ideas why I cannot use my service name in place of the IP Address?</p>
<p>UPDATE:</p>
<p>Running <code>wget -O- game-service-app</code> gives me a HTTP status of 200 but a response of:</p>
<pre><code> [&lt;=&gt;   
                                                                                                           ]       0  --.-KB/s               &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;&lt;html&gt;&lt;head&gt;&lt;meta http-equiv=&quot;refresh&quot; content=&quot;0;url=https://searchassist.verizon.com/main?ParticipantID=euekiz39ksg8nwp7iqj2fp5wzfwi5q76&amp;FailedURI=http%3A%2F%2Fgame-service-app%2F&amp;FailureMode=1&amp;Implementation=&amp;AddInType=4&amp;Version=pywr1.0&amp;ClientLocation=us&quot;/&gt;&lt;script type=&quot;text/javascript&quot;&gt;url=&quot;https://searchassist.verizon.com/main?ParticipantID=euekiz39ksg8nwp7iqj2fp5wzfwi5q76&amp;FailedURI=http%3A%2F%2Fgame-service-app%2F&amp;FailureMode=1&amp;Implementation=&amp;AddInType=4&amp;Version=pywr1.0&amp;ClientLocation=us&quot;;if(top.location!=location){var w=window,d=document,e=d.documentElement,b=d.body,x=w.innerWidth||e.clientWidth||b.clientWidth,y=w.innerHeight||e.clientHeight||b.clientHeight;url+=&quot;&amp;w=&quot;+x+&quot;&amp;h=&quot;+y;}-                                                      [ &lt;=&gt;    
</code></pre>
<p>Indicating a failed DNS lookup.</p>

user2779450
<p>Turns out, the issue was that my API Gateway was in a separate namespace than my services and that was causing problems. By specifying &quot;game-service-app.&quot; whenever referencing the service, I was able to resolve this.</p>
