<p>How does the communication between two different pods happen in Kubernetes?</p>

<p>In my case I have two pods: <em>frontend</em> and <em>backend</em>, both have different containers.
I want my frontend pod to communicate with the backend pod but I don't want to use backend pod's IP( i.e.  hard coded). </p>

<p>Is it possible through services? </p>

<blockquote>
  <p>Is it possible through services?</p>
</blockquote>

<p>Yes, <a href="https://kubernetes.io/docs/concepts/services-networking/" rel="noreferrer">services</a> are the recommended way to handle this. Once you have your services set up for each pod (or replication controller, as is recommended), you can find the service IP via the <a href="https://kubernetes.io/docs/concepts/services-networking/service/#environment-variables" rel="noreferrer">service environment variable</a>, e.g. <code>BACKEND_SERVICE_HOST</code> and <code>BACKEND_SERVICE_PORT</code> for a "backend" service.</p>
