<p>I want to access my backend pods using an internal Kubernetes dns name. Instead of using <a href="http://somepodip:8080/get" rel="nofollow noreferrer">http://somepodip:8080/get</a> I want to use <a href="http://backend:8080/get" rel="nofollow noreferrer">http://backend:8080/get</a> to use my backend.</p>

<p>I am currently running my backend pods and have hooked them up to a service.</p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: backend
spec:
  selector:
    app: myapp-backend
  ports:
  - name: http
    protocol: TCP
    port: 8080
    targetPort: 8080
</code></pre>

<p>This does assign my pods to the backend service. But when I try to use a frontend pod with <a href="http://backend/get" rel="nofollow noreferrer">http://backend/get</a> , it does not find the resource. </p>

<p>Am I incorrectly configuring the service?</p>

Gurpreet Heir
<p>Your service seems to be ok, the issue could be possibly because your frontend is not server rendered, which means that your browser is trying to lookup for a name <code>backend</code>, in that case you cannot rely on kubernetes service name as your browser does not recognize it as a valid hostname.</p>

<p>If you want to access externally by instead of ip, you want to use names, check how to setup a ingress entry <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#what-is-ingress" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/ingress/#what-is-ingress</a></p>
