This project represents a real-time chat application designed for seamless communication. It leverages the power of modern frameworks and tools, integrating Kubernetes for orchestration and Vertical Pod Autoscaling (VPA) to optimize resource utilization dynamically.
The backend is built using Spring Boot, facilitating robust server-side logic, while the frontend is crafted with React, ensuring an intuitive user interface. Real-time communication is enabled using SockJS.
- User Authentication: Secure login functionality to manage user access.
- Real-Time Messaging: Enables users to exchange messages instantly in a chatroom.
- User Presence Tracking: Notifications inform users when others join or leave the chatroom.
- Private Messaging: Allows users to send direct messages to specific participants.
- Media Sharing: Supports the exchange of multimedia content, including images and videos.
- Logout Feature: Ensures a smooth and secure logout experience.
- Resource Optimization: Kubernetes orchestrates deployments, while VPA automatically adjusts resources based on load.
- Spring Boot: Handles server-side processing and business logic.
- SockJS: Provides WebSocket emulation for real-time communication.
- React: Builds the user interface for a responsive user experience.
- Docker: Containers the application components for portability.
- Kubernetes: Manages the deployment, scaling, and availability of application resources.
- Vertical Pod Autoscaler (VPA): Dynamically adjusts the CPU and memory allocation for pods to ensure optimal performance.
- Clone the repository:
git clone https://github.com/ojasvisharma04/Vertical_Pod_Autoscaling_Kubernetes.git
- Navigate to the backend directory:
cd chatroom-backend
- Install dependencies and start the backend server:
mvn clean install mvn spring-boot:run
- Navigate to the frontend directory:
cd chatroom-ui
- Install dependencies and start the React development server:
npm install npm run dev
- Access the application at:
http://localhost:5173
-
Build Docker images for both frontend and backend:
- Backend:
docker build -t your-dockerhub-username/chatroom-backend .
- Frontend:
docker build -t your-dockerhub-username/chatroom-ui .
- Backend:
-
Log in to DockerHub:
docker login
-
Push the images to DockerHub:
- Backend:
docker push your-dockerhub-username/chatroom-backend
- Frontend:
docker push your-dockerhub-username/chatroom-ui
- Backend:
- Minikube or any Kubernetes cluster setup
- Kubectl for cluster management
- Apply the backend deployment and service configurations:
kubectl apply -f backend-deployment.yaml kubectl apply -f backend-service.yaml
- Apply the frontend deployment and service configurations:
kubectl apply -f frontend-deployment.yaml kubectl apply -f frontend-service.yaml
- Deploy the Vertical Pod Autoscaler (VPA) for backend and frontend pods:
kubectl apply -f backend-vpa.yaml kubectl apply -f frontend-vpa.yaml
To access the application via Minikube, expose the services:
-
Frontend:
minikube service chatroom-ui --url
-
Backend:
kubectl port-forward svc/chatroom-backend 8080:8080
Check the status of your pods and VPA configuration:
-
Verify pod status:
kubectl get pods
-
Inspect VPA settings:
kubectl describe vpa chatroom-backend-vpa kubectl describe vpa chatroom-ui-vpa