<p>Situation: We got a webapp with 3 Docker Container (frontend, backend, database) (which I will call 'Unit' in the following context) and we would like to make a demo side where each visitor would get a unique Unit which does not live longer then for example 20 minutes of inactivity.
The reason is, that we want each potential user to have a clean-state experience on the demo page. And specially, we don't want anyone to read anything (for example racist) that an other visitor has left behind.</p>

<p>Is something like this doable with Docker / k8s?</p>

<p>EDIT: It would not be a problem to hide this behind another website á la "Click here to start the demo" which then would start up a new Unit before navigating.</p>

<p>TLDR: How to deploy a unique docker container for each visitor of our webapp.</p>

dturnschek
<blockquote>
  <p>Is something like this doable with Docker / k8s?</p>
</blockquote>

<p>Absolutely. I can see at least a two ways of achieving that with k8s.</p>

<ol>
<li>The Easy, but potentially expensive way (if you run k8s in a cloud).</li>
</ol>

<p>You can combine these 3 containers (frontend, backend, database) into a single Pod and spin up a new pod for each user. One user - one Pod (or set of Pods if needed). This is easy, but can be very expensive (if you have a lot of users). The Pod can be later destroyed if it is not needed anymore.</p>

<ol start="2">
<li>More complex, but not that expensive way.</li>
</ol>

<p>If your software allows you running a frontend and backend that are the same for all the users, than it is possible moving "unique" content to the database. For example into some table/set of tables. In this case only a few pods will be constantly up instaed of "full set for each user". The data is stored in database.</p>

<p>You can flush the database periodically, to wipe out all the assets your users create during tests. </p>

<p>As a result you may end up with much smaller "footprint" compared to the first option.</p>

<p>Hope that helps. </p>
