<p>We have a microservices/ish archictecture we currently on a VM. Each of our applications are deployed as DLLs with no executable. To run them, we spawn a new instance of our activator, passing the path of the application as an argument. The process activator injects behaviors on the application via DI, such as proxies and service discovery logic.</p>
<p>This has the benefit that the applications and the process activator can be developed, managed and deployed  independently of one another. If we have an update for the activator, we only need to deploy it and restart all applications for our changes to take effect; No need to re-deploy an application, much less to rebuild it.</p>
<p>As we are now developing a plan to migrate our archictecture to Kubernetes, however, we've hit a roadblock because of this design. We haven't been able to find a way to replicate this. We've thought of doing it by simply deploying the two together and setting the activator as the entrypoint; However, that would mean that anytime we update the activator, all applications' images would have to be updated as well, which completely defeats the purpose of this design.</p>
<p>We've also thought of deploying them as two different containers and somehow making the activator read the contents of the application container and then load its DLLs, but we don't know if it's possible for a container to read the contents of another.</p>
<p>In the end, is there a way to make this design work in Kubernetes?</p>

andre_ss6
<p>If the design requires the following:</p>
<ul>
<li>Inject files into the main container to change its behaviour</li>
</ul>
<p>Then a viable choise is to use init containers. Init containers can perform operations before the main container (or containers) starts, for example they could copy some files for the main container to use.</p>
<p>You could have this activator as the main container and all the various apps being a different init container which contains the DLLs of that app.</p>
<p>When an init container starts, it copies the DLLs of that app on an ephemeral volume (aka <code>emptyDir</code>) to make them available to the main container. Then the activator container starts and find the DLLs at a path and can do whatever it wants with them.</p>
<p>This way:</p>
<ul>
<li>If you need to update the activator, you need to update the main container image (bump its tag) and then update the definitions of all the Deployments / StatefulSets to use the new image.</li>
<li>If you need to update one of the apps, you need to update its single init container image (bump its tag) and then update the definition of the Deployment / StatefulSet of that particular app.</li>
</ul>
<p>This strategy works perfectly fine (I think) if you are ok with the idea that you'll still need to define all the apps in the cluster. If you have 3 apps, A, B and C, you'll need to define 3 Deployments (or StatefulSets if the apps are stateful for some reasons) which uses the right init containers.</p>
<p>If the applications are mostly equal and only few things changes.. like only the DLLs to inject to the activator, you could think of using HELM to define your resources on the cluster, as it makes you able to template the resources and personalize them with very little overhead.</p>
<hr />
<p>Some documentation:</p>
<p>Init Containers: <a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/pods/init-containers/</a></p>
<p>Example of making a copy of files between Init container and Main container: <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-initialization/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-initialization/</a></p>
<p>HELM: <a href="https://helm.sh/docs/" rel="nofollow noreferrer">https://helm.sh/docs/</a></p>
