Location Research Breakthrough Possible @S-Logix pro@slogix.in

Containerized Deployment of an On-Premises Monolithic Inventory Management Application on a Managed Kubernetes Cluster

Description

This project focuses on an existing monolithic inventory management system used to manage products, stock, suppliers, purchase orders, sales orders, and inventory reports. The application is packaged as a Docker image, stored in a container registry, and deployed on a managed Kubernetes cluster. Kubernetes manages the application containers, while cloud storage, database, networking, and monitoring services support the application.

Aim

To containerize an existing on-premises monolithic inventory management application and deploy it on a managed Kubernetes cluster to improve scalability, reliability, and deployment management.

Objectives

01 Containerize the existing application using Docker.
02 Store Docker images in a container registry.
03 Deploy and manage the application on managed Kubernetes.
04 Connect the application to the required database and storage.
05 Provide secure access through Ingress/Load Balancer.
06 Monitor application and container performance.
07 Improve application availability and scalability.

Application Workflow

01

Stage 1 – User Login

Process

Inventory staff log in to the inventory management application to access products, stock, suppliers, and orders.

Tools
Kubernetes Ingress PostgreSQL
Implementation

The user request reaches the application through Ingress. The monolithic application validates the user and provides access to the inventory modules.

02

Stage 2 – Product Management

Process

Staff add new products, update product details, and view existing products.

Tools
Kubernetes PostgreSQL
Implementation

The Product module processes the request and stores product information such as product name, category, price, and quantity in PostgreSQL.

03

Stage 3 – Stock Management

Process

Staff check available stock and update quantities when products are received or issued.

Tools
PostgreSQL
Implementation

The application retrieves the current stock from PostgreSQL. Received products increase the stock quantity, while issued or sold products decrease it.

04

Stage 4 – Purchase and Supplier Management

Process

Staff maintain supplier information and create purchase orders when stock needs to be replenished.

Tools
PostgreSQL
Implementation

The application stores supplier and purchase-order details in PostgreSQL and updates stock when purchased products are received.

05

Stage 5 – Sales and Order Processing

Process

Staff process product sales or orders and update the available inventory.

Tools
PostgreSQL
Implementation

The application records the order and reduces the corresponding stock quantity in PostgreSQL.

06

Stage 6 – Inventory Reports

Process

Managers view stock levels, low-stock products, purchase history, and sales reports.

Tools
PostgreSQL
Implementation

The reporting module retrieves inventory and transaction data from PostgreSQL and generates the required reports.

07

Stage 7 – Containerized Deployment

Process

The existing monolithic inventory application is packaged and deployed as a container.

Tools
Docker Cloud ECR Kubernetes
Implementation

Docker creates the application image, Cloud ECR stores the image, and Kubernetes pulls the image and runs it as a pod on the Kubernetes nodes.

08

Stage 8 – Monitoring

Process

The application and Kubernetes environment are monitored for availability and performance.

Tools
Prometheus Grafana Kubernetes
Implementation

Prometheus collects application and Kubernetes metrics, while Grafana displays the metrics in monitoring dashboards.

Cloud Infrastructure and Tools

Cloud Compute Cloud EC2

Provides the virtual machines where the Kubernetes nodes run and the containerized inventory application is deployed.

Operating System Ubuntu Server 24.04 LTS

Provides the operating environment for the Kubernetes nodes running on EC2.

Cloud Network Cloud VPC

Provides the private network for the EC2 servers, Kubernetes cluster, application, and database.

Containerization Tool Docker

Packages the existing monolithic inventory application and its dependencies into a Docker image.

Container Registry Cloud ECR

Stores the Docker image so that Kubernetes can pull it during deployment.

Container Orchestration Tool Kubernetes

Deploys, manages, scales, and restarts the containerized inventory application.

Load Balancer NGINX

Receives external HTTP/HTTPS requests and forwards them to the inventory application running inside Kubernetes. When multiple application pods are running, NGINX distributes incoming requests between them.

Database PostgreSQL

Stores product, stock, supplier, purchase, and sales information.

Persistent Storage Cloud EBS

Provides persistent block storage for workloads that require storage attached to the EC2 nodes.

Deployment Tool Helm

Packages and manages the Kubernetes deployment configuration for the inventory application.

Infrastructure as Code Tool OpenTofu

Creates and manages Cloud infrastructure such as VPC, EC2, networking, and security resources using code.

Configuration Automation Tool Ansible

Automates configuration of the Ubuntu servers and installation of required Kubernetes and supporting packages.

Monitoring Tool Prometheus

Collects application, container, and Kubernetes performance metrics.

Dashboard Tool Grafana

Displays application and infrastructure metrics through monitoring dashboards.

Implementation Process

01
Step 1 – Analyze the Existing Application
  • Identify the existing on-premises monolithic inventory application.
  • Identify application modules such as product, stock, supplier, and order management.
  • Check the application runtime and required dependencies.
  • Identify the PostgreSQL database requirements.
  • Review configuration files and environment variables.
  • Check storage and network requirements.
02
Step 2 – Containerize the Application
  • Create a Dockerfile for the inventory application.
  • Define the required runtime and dependencies.
  • Build the Docker image using Docker.
  • Run the container locally for testing.
  • Verify application and database connectivity.
  • Fix any container-related configuration issues.
03
Step 3 – Store the Docker Image
  • Set up a container registry such as Cloud ECR or Harbor.
  • Create a repository for the inventory application.
  • Tag the Docker image with a version.
  • Authenticate Docker with the registry.
  • Push the image to the registry.
  • Verify that the image is available for Kubernetes.
04
Step 4 – Configure Kubernetes
  • Set up the Kubernetes cluster on EC2.
  • Configure the Ubuntu environment on the Kubernetes nodes.
  • Configure the required VPC and network connectivity.
  • Create Kubernetes Deployment configuration.
  • Create a Kubernetes Service for the application.
  • Configure application environment variables and database connectivity.
05
Step 5 – Deploy and Expose the Application
  • Configure Kubernetes to pull the Docker image from the registry.
  • Deploy the inventory application as a Kubernetes Pod.
  • Verify that the pod is running successfully.
  • Configure the Kubernetes Service to expose the application.
  • Configure NGINX as a reverse proxy and load balancer.
  • Test external user access to the inventory application.
06
Step 6 – Monitor and Test
  • Deploy Prometheus to collect application and Kubernetes metrics.
  • Configure Grafana for monitoring dashboards.
  • Test product, stock, supplier, and order operations.
  • Test application access through NGINX.
  • Stop or fail a container and verify Kubernetes recovery.
  • Monitor application performance and errors before production deployment.

Proposed Solution

The proposed solution modernizes the existing on-premises monolithic inventory management application by moving it to a cloud-based container environment. The application is packaged as a Docker container, stored in a container registry, and deployed on Kubernetes running on Cloud EC2 servers. NGINX handles external HTTP/HTTPS requests and forwards them to the inventory application. PostgreSQL stores product, stock, supplier, purchase, and sales data. OpenTofu and Ansible automate infrastructure and server configuration, while Prometheus and Grafana provide application and Kubernetes monitoring. The solution improves deployment, availability, scalability, and monitoring without changing the existing application logic.

Benefits

Cloud Migration: Moves the application from on-premises servers to cloud infrastructure.
Containerization: Packages the existing application with its required dependencies.
Easy Deployment: Docker images can be consistently deployed using Kubernetes.
Automatic Recovery: Kubernetes can restart failed application containers.
Scalability: Kubernetes can increase application instances when workload grows.
Better Monitoring: Prometheus and Grafana provide visibility into application and Kubernetes performance.
Infrastructure Automation: OpenTofu and Ansible reduce manual configuration work.

Challenges

Large Container Image: A monolithic application may create a large Docker image.
Migration Complexity: Moving an existing on-premises application to containers may require configuration changes.
Kubernetes Complexity: Kubernetes requires proper configuration of deployments, services, networking, and storage.
Database Migration: Existing inventory data must be migrated and connected correctly.
Resource Management: Kubernetes nodes require sufficient CPU, memory, and storage.
Monitoring Overhead: Prometheus and Grafana consume additional resources for monitoring.