<p>So I have an application. So I want to deploy that application using a separate docker container for every user that signs up. I also want them to be deployed on a different subdomain for e.g.</p>
<ol>
<li>if my domain is <a href="https://example.com" rel="nofollow noreferrer">https://example.com</a> I want to deploy <a href="https://x.example.com" rel="nofollow noreferrer">https://x.example.com</a></li>
<li>if x sign up and <a href="https://y.example.com" rel="nofollow noreferrer">https://y.example.com</a> if y sign up.<br/>
I want these deployments to be done after a user finishes the signup process and deletes them if a user chooses to deregister themselves. Also, the database for these users will be different but should be manageable using a centralized mechanism.
<strong>What is the best approach for this type of application?</strong></li>
</ol>

<p><strong>These kind of dynamic deployments are not natively supported by K8s.</strong> However, you can build something yourself, by creating an application that has sufficient RBAC permissions on the API-Server on the Deployment resource, as well as functionality to create those deployments. Furthermore, it exposes a REST-API that can be called within your cluster to trigger those deployments on demand.</p>
<p>A while ago, I created a Github project to illustrate how it is done: <a href="https://github.com/fritzduchardt/k8scrud" rel="nofollow noreferrer">k8scrud</a>. Please feel free to use it as inspiration or directly.</p>
