<p>I am pretty new to kubernetes and I have successfully setup a cluster on google container engine .
In my cluster I have a backend api developed with dropwizard, front end developed with node js and a mysql database. 
All have been deployed to the cluster and are working .However my challenge is this after setting up an external ip for my node containers and backend I can access them remotely but I can't access my backed from my front end using the service name e.g my backend is called backendapi within the cluster. I can't do this <a href="http://backendapi:8080" rel="noreferrer">http://backendapi:8080</a> to call my rest services when deployed to the cluster .
The catch for me is when I deploy to the cluster I don't want my front end to hit my back end using the external ip, I want them to connect within the cluster without going via the external ip address. When I connect to a pod and ping backendapi it returns a result but when I deploy my front end and use the label name it doesn't work .What could I be doing wrong ?.</p>

<p>As long as <code>kube-dns</code> is running (which I believe is "always unless you disable it"), all Service objects have an <em>in cluster</em> DNS name of <code>service_name +"."+ service_namespace + ".svc.cluster.local"</code> so all other things would address your <code>backendapi</code> in the <code>default</code> namespace as (to use your port numbered example) <code>http://backendapi.default.svc.cluster.local:8080</code>. That fact is the very reason Kubernetes forces all identifiers to be a "dns compatible" name (no underscores or other goofy characters).</p>

<p>Even if you are <em>not</em> running kube-dns, all Service names and ports are also injected into the environment of Pods just like docker would do, so the environment variables <code>${BACKENDAPI_SERVICE_HOST}:${BACKENDAPI_SERVICE_PORT}</code> would contain the Service's in-cluster IP (even though the env-var is named "host") and the "default" Service port (8080 in your example) if there is only one.</p>

<p>Whether you choose to use the DNS name or the environment-variable-ip is a matter of whether you like having the "readable" names for things in log output or error messages, versus whether you prefer to skip the DNS lookup and use the Service IP address for speed but less legibility. They <em>behave</em> the same.</p>

<p>The whole story lives <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="noreferrer">in the services-networking concept documentation</a></p>
