<p>I have a little java project that needs to be deployed with kubernetes.
After studying kubernetes for a little while, I have two questions.</p>

<p>Since the projects needs beside the java app, rabbitmq and redis, clearly those three thing need to have three docker images.</p>

<p>1.) Can I put the java app, rabbitmq and redis containers/images into a single pod or should they be in separete pods (I was advised to put them on the same pod)?</p>

<p>Since this is a java app (with a build .jar file) is has a foobar.conf file that has the configurations for the app, like the redis/rabbitmq hostnames and ports and other stuff in it.</p>

<pre><code>  rabbitmq{
        host="$RABBITMQ_HOSTNAME"
        username="rabbitmq"
        password="rabbitmq"
        status-queue-name="foobar-status"
        audit-queue-name="foobar-audit"
        event-queue-name="foobar-events"
        incoming-messages-queue-name="foobar-incoming-messages"
        acknowledge-queue-name="foobar-acknowledge"
  }
</code></pre>

<p>So, how do I expose the redis and rabbitmq containers ports and hostnames (when they spin up) to the foobar.conf files for the app?</p>

<p>Tnx,
Tom</p>

Tomislav Mikulin
<p>If you should place all three services within one Pod or not depends on how you would scale the application.</p>

<p>For example, if you would like to run a second instance of the Java application, would each app instance use it's "private" RabbitMQ and Redis (an all-in-one Pod is fine), or would the instances share RabbitMQ and/or Redis?</p>

<p>As soon as one component is shared between several instances, it should run in an own Pod and be exposed (within the namespace) via a Service.</p>

<p>Finally: if you don't know whether the application needs scaling in the future, plan for scaling at day 0 (it's easier than to redo things later).</p>
