I'm developing a web application in NodeJS and I want to create multiple instances of the same application to deploy it in multiple subdomains of my main domain. I want each instance to have the same application but a different database for each. But I don't know how to do it.

I looked into it and it turns out that if I use Docker, Kubernetes and deploy to a cloud provider, that can solve my problem. The problem is that I know very little about Kubernetes and I have a question I can't answer!

Since each subdomain must point to the IP address of an instance of my application. How can I solve this problem? Do I have to create a cluster for each subdomain or is there a way to put them all in one? What do you think about this solution?

If you have a resource or another completely different solution, I'm open to anything. Thank you.

2 Answers 2


You can create multiple instances of your application and in your application you can configure database details to use different databases.

For routing part, you can setup a proxy server using Apache2/Nginx/HA Proxy.

Your domain and sub-domains point to proxy server ip and Proxy server route the traffic to desired upstream application instance based on routing rules.

This can be done without kubernetes and docker on any virtual machine from any cloud provider.

  1. Deploy your application in different namespaces.
  2. Use configmaps in each namespace to specify a DB endpoint(This way you can specify different DB endpoints for each instance of the application).
  3. It is your choice to deploy multiple ingress according to your domains, which ideally you should or to use an nginx, or any equivalent tool to forward your request to a particular application.

I hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.