<p>We are trying to implement Kubernetes in our system and we have two mysql databases and two services.</p>

<p>One service should be able to connect to both databases and the other uses just one.</p>

<p>So <code>auth-service</code>-><code>key-db</code> and <code>transaction-service</code>-><code>key-db + pdns-db</code>.</p>

<p>I currently the databases running and both exposing port <code>3306</code> (default mysql) with hostname <code>key-db</code> and <code>pdns-db</code>. The <code>auth-service</code> is able to connect to the <code>key-db</code> fine. But when I try to start the <code>transaction-service</code> which connects to <code>key-db:3306</code> and <code>pdns-db:3306</code> it fails.</p>

<p>We don't want to expose the databases so we didn't gave them a Cluster IP.
I'm pretty new to this stuff so I guess I'm missing something.</p>

<p>Thanks in advance.</p>

<p>Theo</p>

Dirk
<p>You have to put a Service in front of any Pod that you want to connect to from anywhere, even within the cluster.  If you declare it a ClusterIP type (the default) it will only be reachable from within the cluster.  You have to explicitly set up the service as a NodePort or LoadBalancer type if you want it to be reachable from outside.</p>
