<p>I am trying to host a simple Node.js app connected to MongoDB, I look on the web, I've found 2 different methods and some guides to do so:</p>

<ol>
<li><p>Different pods:</p>

<ul>
<li><a href="https://github.com/kubernetes/kubernetes/tree/master/examples/nodesjs-mongodb" rel="nofollow noreferrer">Example</a> from the official Kubernetes documentation.</li>
<li><a href="https://medium.com/google-cloud/running-a-mean-stack-on-google-cloud-platform-with-kubernetes-149ca81c2b5d" rel="nofollow noreferrer">Example</a> from the official Google Cloud Platform documentation.</li>
</ul></li>
<li><p>Same pod: </p>

<ul>
<li><a href="https://developer.ibm.com/recipes/tutorials/kubernetes-how-to-run-a-node-js-application-which-accesses-mongo-database-where-both-are-running-in-containers-in-a-single-pod/" rel="nofollow noreferrer">Example</a> from the official IBM documentation.</li>
</ul></li>
</ol>

<p>This confused me a bit, which is the best practise to achieve that?</p>

<p>You should put them in different pods.</p>

<p>Being in different pods you can then scale up the number of replicas of the web application part to as many instances as you need and you will still have the one instance of MongoDB.</p>

<p>If you had them in the same pod, you wouldn't be able to scale up to multiple instances as each replica would have its own MongoDB instance and thus separate data. If doing data updates to MongoDB from the web application, that would cause all sorts of problems as subsequent requests could hit a difference instance and so see different data.</p>
