Scalable Fullstack Web App in Kubernetes

Today I am going to talk about how to we can create a scalable web application with microservice. 🐳

I wanted to deploy a full-stack application on a Kubernetes cluster but never found a good video that does it, so that’s what I will be doing today.

What our stack consists. It’s just a POC, so I’m not going to use anything fancy.
This application has a front end which has been created with HTML/CSS and will be hosted with nginx and a backend with Node.js express and connected to Mongo DB. Initially, I did not want to add the database in the stack as it does not work in production as it is not scalable🙅‍♂️, but why not.


BackEnd Application | Express Node js ⚙️

this Is a simple server app where it sends data that backend is connected and the database is also connected

FrontEnd | NGINX 💻

I'm using Tailwind to have a nice display and get the data from the backend to display it.

lastly, I'm just using a mondoDB image from docker hub

Build the Docker Image 🐳




So now we can scale it with microservice architecture.

we are going to use Docker to containerise our application

Now we can deploy the image as a container and scale it up
we need to create a deployment for the application and service to deliver the application. We will start by creating a deployment from this YAML file we have got.

Create the Deployment and services

Likewise, we can deploy the service from the YAML file.
If you have a Kubernetes service named frontend-service, you can use mongo-service as the DNS name of your application. It’s the responsibility of Kubernetes to forward the request to the corresponding pod.





So this is the final output we will get when you enter


Feel free to reach out to me. 😊

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store