Search code examples
dockerkubernetes3-tier

3 tier architecture on kubernetes


I have 1 master kubernetes server and 9 nodes. In that, I want to run backend on 2 nodes and frontend on 2 nodes and DB on 3 nodes.

For all backend, frontend, DB I have ready DockerImage.

How to run an image using kubernetes on only desired(2 or 3).

Please share some ideas to achieve the same.


Solution

    1. Run the front end as a Deployment with desired replica count and let kubernetes manage it for you.

    2. Run Backend as Deployment with desired number of replicas and Kubernetes will figure out how to run it. Use node selectors if you prefer specific nodes.

    3. Run the DB as Deployment OR StatefulSet, Kubernetes will figure out how to run it.

    https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/

    Use network policies to restrict traffic.