<p><a href="https://i.stack.imgur.com/ShZX2.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ShZX2.jpg" alt="enter image description here"></a></p>

<p>I have an application running in multiple pods. You can imagine the app as a web application which connects to Postgres (so each container has both app and Postgres processes). I would like to mount the volume into each pod at <code>/var/lib/postgresql/data</code> so that every app can have the same state of the database. They can read/write at the same time.</p>

<p>This is just an idea of how I will go. 
My question is: is there any concern I need to be aware of? Or is this the totally wrong way to go?</p>

<p>Or will it be better to separate Postgres from the app container into a single pod and let the app containers connect to that one pod?</p>

<p>If my questions show knowledge I lack, please provide links I should read, thank you!</p>

<p>This will absolutely fail to work, and PostgreSQL will try to prevent you from starting several postmasters against the same data directory as good as it can. If you still manage to do it, instant data corruption will ensue.</p>

<p>The correct way to do this is to have a single database server and have all your &ldquo;pods&rdquo; connect to that one. If you have many of these &ldquo;pods&rdquo;, you should probably use a connection pooler like pgbouncer to fight the problems caused by too many database connections.</p>
