<p>I have an HTTP application (Odoo). This app support install/updating modules(addons) dynamically.</p>
<p>I would like to run this app in a Kubernetes cluster. And I would like to dynamically install/update the modules.</p>
<p>I have 2 solutions for this problem. However, I was wondering if there are other solutions.</p>
<p><strong>Solution 1:</strong></p>
<ul>
<li>Include the custom modules with the app in the Docker image</li>
<li>Every time I made a change in the custom module and push it to a git repository. Jinkins pull the changes and create a new image and then apply the new changes to the Kubernetes cluster.</li>
</ul>
<p><strong>Advantages</strong>: I can manage the docker image version and restart an image if something happens</p>
<p><strong>Drawbacks</strong>: This solution is not bad for production however the list of all custom module repositories should all be included in the docker file. Suppose that I have two custom modules each in its repository a change to one of them will lead to a rebuild of the whole docker image.</p>
<p><strong>Solution 2:</strong></p>
<ul>
<li>Have a persistent volume that contains only the custom modules.</li>
<li>If a change is made to a custom module it is updated in the persistent volume.</li>
<li>The changes need to apply to each pod running the app (I don't know maybe doing a restart)</li>
</ul>
<p><strong>Advantages</strong>: Small changes don't trigger image build. We don't need to recreate the pods each time.</p>
<p><strong>Drawbacks</strong>: Controlling the versions of each update is difficult (I don't know if we have version control for persistent volume in Kubernetes).</p>
<p><strong>Questions:</strong></p>
<ul>
<li>Is there another solution to solve this problem?</li>
<li>For both methods, there is a command that should be executed in order to take the module changes into consideration <code>odoo --update &quot;module_name&quot;</code>. This command should include the module name. For solution 2, How to execute a command in each pod?</li>
<li>For solution 2 is it better to restart the app service(odoo) instead of restarting all the nodes? Meaning, if we can execute a command on each pod we can just restart the service of the app.</li>
</ul>
<p>Thank you very much.</p>

<p>You will probably be better off with your first solution. Specially if you already have all the toolchain to rebuild and deploy images. It will be easier for you to rollback to previous versions and also to troubleshoot (since you know exactly which version is running in each pod).</p>
<p>There is an alternative solution that is sometime used to provision static assets on web servers: You can add an emptyDir volume and a sidecar container to the pod. The sidecar pull the changes from your plugins repositories into the emptyDir at fixed interval. Finally your app container, sharing the same emptyDir volume will have access to the plugins.</p>
<p>In any case running the command to update the plugin is going to be complicated. You could do it at fixed interval but your app might not like it.</p>
