<p>First of all, this is a question regarding my thesis for school. I have done some research about this, it seems like a problem that hasn't been tackled yet (might not be that common).</p>

<p>Before jumping right into the problem, I'll give a brief example of my use case.</p>

<p>I have multiple namespaces containing microservices depending on a state X. To manage this the microservices are put in a namespace named after the state. (so namespaces state_A, state_B, ...)</p>

<p>Important to know is that each microservice needs this state at startup of the service. It will download necessary files, ... according to the state. When launching it with state A version 1, it is very likely that the state gets updated every month. When this happens, it is important to let all the microservices that depend on state A upgrade whatever necessary (databases, in-memory state, ...).</p>

<p>My current approach for this problem is simply using events, the microservices that need updates when the state changes can subscribe on the event and migrate/upgrade accordingly. The only problem I'm facing is that while the service is upgrading, it should still work. So somehow I should duplicate the service first, let the duplicate upgrade and when the upgrade is successful, shut down the original. Because of this the used orchestration service would have to be able to create duplicates (including duplicating the state).</p>

<p>My question is, are there already solutions for my problem (and if yes, which ones)? I have looked into Netflix Conductor (which seemed promising with its workflows and events), Amazon SWF, Marathon and Kubernetes, but none of them covers my problem.</p>

<p>Best of all the existing solution should not be bound to a specific platform (Azure, GCE, ...).</p>

<p>For uninterrupted upgrade you should use clusters of nodes providing your service and perform a rolling update, which takes out a single node at a time, upgrading it, leaving the rest of the nodes for continued servicing. I recommend looking at the concept of virtual services (e.g. in <a href="https://coreos.com/kubernetes/docs/latest/services.html" rel="nofollow noreferrer">kubernetes</a>) and <a href="https://kubernetes.io/docs/tutorials/kubernetes-basics/update-intro/" rel="nofollow noreferrer">rolling updates</a>.</p>

<p>For inducing state I would recommend looking into container initialization mechanisms. For example in docker you can use <a href="https://docs.docker.com/engine/reference/builder/#entrypoint" rel="nofollow noreferrer">entrypoint scripts</a> or in kubernetes there is the concept of <a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/" rel="nofollow noreferrer">init containers</a>. You should note though that today there is a trend to decouple services and state, meaning the state is kept in a DB that is separate from the service deployment, allowing to view the service as a stateless component that can be replaced without losing state (given the interfacing between the service and required state did not change). This is good in scenarios where the service changes more frequently and the DB design less frequently.</p>

<p>Another note - I am not sure that representing state in a namespace is a good idea. Typically a namespace is a static construct for organization (of code, services, etc.) that aims for stability. </p>
