<p>I am using k8s 1.5 and am stuck in one issue.
I am trying to deploy 2 pods and related service. We can consider one as UI and another as DB. I have seen that using Service Discovery, we can achieve the connectivity between both the pods.</p>

<p><strong>Problem 1</strong>: 
While getting inside the container of UI Pod, if I am entering <code>env</code> then, I am getting the env variables of Kubernetes service, but I am not getting the env variables of DB Pod. And according to my knowledge, whenever we run any pod then it exposes two variable and i.e SERVICE_HOST and SERVICE_PORT and that should be available to all the pods in that namespace.</p>

<p><strong>Problem 2</strong>:
Sometimes the UI Pod doesnot show its own variable also, and after retry sometimes it will come. Means it takes time show the environment variable of itself.</p>

<p>Can Anyone suggest me what to do in this scenario ? Does the environment variables maintain orders. If anyone have any nice example then pls let me know.</p>

<p><strong>Note</strong>: Both deployment and service files are deployed on the same namespace.</p>

<p>In the examples that I've seen (<a href="https://github.com/kubernetes/kubernetes/blob/master/examples/guestbook-go/main.go" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/blob/master/examples/guestbook-go/main.go</a>, line 77), they use the service dns name instead of environment variables (just like you do when linking containers in docker). The same happens with Helm charts (<a href="https://github.com/kubernetes/charts/blob/master/stable/wordpress/templates/deployment.yaml" rel="nofollow noreferrer">https://github.com/kubernetes/charts/blob/master/stable/wordpress/templates/deployment.yaml</a>), where in all deployments they use the service name and the port, which is something known (in the case of Helm, generated at deployment time). Would it work for you to directly use the service name and the port? </p>
