<p>I have two back-end deployments, REST server and a database server, each running on some specific ports. The REST server internally calls a database server.</p>

<p>Now how do I refer my database server deployment in my REST server deployment so that they can communicate with each other?</p>

Punit Naik
<p>first, define a service for your DB server, that will create sort of a loadbalancer (internal kube integration based on iptables in most cases). With that, you will be able to refer to it by service name or fqdn like <code>mydbsvc.namespace.svc.cluster.local</code>. Which will return "Cluster IP" to that loadbalancer.</p>

<p>Then it's just an issue of regular app config to point it to your DB on <code>mydbsvc</code>, preferably by means of env variable like say DB_HOST=mydbsvc set in your REST API deployment manifest (pod template envs)</p>
