0% found this document useful (0 votes)
3 views19 pages

cloud report

The document is a project report by Mohamed Islaam K A on implementing a microservice architecture using Kubernetes, submitted for a Bachelor of Technology degree. It details the transition from monolithic applications to microservices, the use of Docker for containerization, and Kubernetes for orchestration, along with practical implementation steps and system requirements. The project demonstrates deploying a Node.js microservice in a local environment using Minikube, highlighting the advantages of microservices in terms of scalability and maintainability.

Uploaded by

953622205034
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views19 pages

cloud report

The document is a project report by Mohamed Islaam K A on implementing a microservice architecture using Kubernetes, submitted for a Bachelor of Technology degree. It details the transition from monolithic applications to microservices, the use of Docker for containerization, and Kubernetes for orchestration, along with practical implementation steps and system requirements. The project demonstrates deploying a Node.js microservice in a local environment using Minikube, highlighting the advantages of microservices in terms of scalability and maintainability.

Uploaded by

953622205034
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

IMPLEMENT A MICROSERVICE ARCHITECTURE USING KUBERNETES

A MINI PROJECT REPORT

Submitted by

MOHHAMED ISLAAM K A

(953622205028)

In partial fulfillment for the award of the degree of

BACHELOR OF TECHNOLOGY

RAMCO INSTITUTE OF TECHNOLOGY

DEPARTMENT OF INFORMATION TECHNOLOGY

RAJAPALAYAM-626 117

ANNA UNIVERSITY:: CHENNAI 600 025

APRIL 2025

i
ANNA UNIVERSITY,CHENNAI

BONAFIED CERTIFICATE

Certified that this Report titled “IMPLEMENT A MICROSERVICE


ARCHITECTURE USING KUBERNETES” is the bonafide work of Mohamed
Islaam K A (953622205028) who carried out the work under my supervision. Certified
further that to the best of my knowledge the work reported herein does not form part of
any other thesis or dissertation on the basis of which a degree or award was conferred
on an earlier occasion on this or any other candidate.

SIGNATURE SIGNATURE
Mrs. A. Alagulakshmi Dr. V. Anusuya
SUPERVISOR HEAD OF THE DEPARTMENT
Assistant Professor, Associate Professor,
Department of Information Technology, Department of Information Technology,
Ramco Institute of Technology Ramco Institute of Technology
Rajapalayam-626 112. Rajapalayam-626 112.

Submitted for the Project Viva-Voce held on ………………..

Internal Examiner External Examiner

ii
DECLARATION

We hereby declare that the project work entitled “IMPLEMENT A


MICROSERVICE ARCHITECTURE USING KUBERNETES” has been
submitted by me, Mohamed Islaam K A(953622205028) in the partial fulfillment of
the requirement for the award of the degree of Bachelor of Technology – Information
Technology. We further declare that the contents, statements and other relevant matters
are trueto the best of our knowledge.

Place : Rajapalayam.
Mohamed Islaam K A
Date :/ /2025.

DEPARTMENT OF INFORMATION TECHNOLOGY


RAMCO INSTITUTE OF TECHNOLOGY

RAJAPALAYM-626 117.

iii
ACKNOWLEDGEMENT

First and foremost, I express my utmost gratitude to our Chairman, Shri. P.R.
Venketrama Raja, B.E., MBA., for his remarkable support and encouragement toward the
improvement of the college.

I extend my sincere thanks to our respected Principal In-charge, Dr. L. Ganesan, M.E.,
P.hD., for the support rendered toward my project work.

I am deeply grateful to our Vice Principal, Dr. S. Rajakarunakaran, M.E., Ph.D., for
his valuable support in the successful completion of my project.

I am also indebted to Dr. V. Anusuya, M.E., Ph.D., Associate Professor and Head,
Department of Information Technology, for providing the necessary lab facilities to complete
my work.

I convey my heartfelt thanks to my project supervisor, Mrs. A. Alagulakshmi,


Assistant Professor, Department of Information Technology, for her continuous guidance and
support throughout the project work.

I am very much thankful to all the staff members of the Department of Information
Technology for the various ways in which they supported me during the completion of my
project.

Last but not least, I extend my sincere thanks to my friends and family members for
their unwavering support and encouragement throughout my project journey.

iv
ABSTRACT
In the rapidly evolving landscape of software development, microservice architecture
has emerged as a powerful paradigm for designing scalable, maintainable, and loosely
coupled systems. Unlike monolithic applications, microservices divide functionality
into independent services that communicate over lightweight APIs, enabling faster
development cycles, easier debugging, and more efficient scaling. To orchestrate and
manage such services, Kubernetes has become the de facto standard platform due to its
robust features for automating deployment, scaling, and management of containerized
applications.

This implementation focuses on deploying a simple Node.js-based microservice using


Docker and Kubernetes within a local environment facilitated by Minikube. The
microservice was first containerized using Docker and tested locally to ensure proper
functionality. After verifying the application, the Docker image was pushed to Docker
Hub to make it accessible to Kubernetes. Kubernetes deployment and service
configuration files were then created to manage the pod lifecycle and expose the
microservice externally using a NodePort service. The entire setup was tested by
accessing the deployed microservice via the Minikube-provided IP and service port.

v
TABLE OF CONTENTS

Chapter No. Contents Page No


1
1 Introduction
1
1.1 Problem Definition
1
1.2 Existing System
2
1.3 Proposed System
2
1.4 Literature Review
3
2 System Requirements
3
2.1 Hardware & Software Requirements
4
2.2 Software Requirements Specification(SRS)
5
3 System Design
5
3.1 Proposed System-Modules of System
6
4 Implementation/Methodology
6
4.1 Sample Code
8
4.2 Test Cases
9
5 Experimental Results
9
5.1 Output Screens
12
6 Conclusion
13
References

vi
1.INTRODUCTION
In today’s fast-paced software industry, the demand for scalable, modular, and resilient
applications has driven the shift from monolithic architectures to microservice-based
systems. A microservice architecture decomposes an application into a collection of
loosely coupled services, each responsible for a specific business function. This
approach enables development teams to build, test, deploy, and scale services
independently, leading to improved agility and fault isolation.

To effectively manage these microservices, container orchestration becomes


essential. Kubernetes, an open-source container orchestration platform developed by
Google, provides a powerful framework for automating deployment, scaling, and
operations of application containers across clusters of hosts. This project implements a
simple Node.js-based microservice, demonstrating how Kubernetes simplifies the
deployment and management of containerized applications using Docker and Minikube
in a local development environment.

1.1PROJECT DESCRIPTION:

Traditional monolithic applications are often difficult to scale, maintain, and


deploy in dynamic environments. Any change in a single component requires rebuilding
and redeploying the entire system, which leads to longer development cycles and higher
chances of system-wide failures. Moreover, monolithic systems lack flexibility when it
comes to adopting new technologies or scaling specific components independently.

1.2 EXITING SYSTEM:

In monolithic architecture, all components of the application—such as the user


interface, business logic, and data access layer—are tightly coupled and reside in a
single codebase. This structure results in limitations such as:

 Difficulties in isolating and resolving issues


 Scalability challenges, since the entire application must be scaled even if only
one module needs it

1
 Lack of flexibility for continuous deployment and integration

 Increased risk of downtime during updates

1.3 PROPOSED SYSTEM:

The proposed system adopts a microservice architecture using Kubernetes to address


the limitations of monolithic systems. Each service is containerized using Docker and
deployed independently via Kubernetes pods. Kubernetes services and deployments
ensure proper scaling, health checks, and availability. Using Minikube, this setup is run
in a local environment for development and testing purposes. Key advantages of the
proposed system include:

 Independent service deployment and scaling


 Fault isolation across services
 Automated recovery and load balancing by Kubernetes
 Easier implementation of CI/CD pipelines

1.4 LITERATURE REVIEW

The concept of microservices was popularized by companies like Netflix and


Amazon, which needed highly scalable systems to handle millions of users. According
to Martin Fowler, microservices are “a suite of small services, each running in its own
process and communicating with lightweight mechanisms.” Research and industrial
case studies highlight that microservice architecture significantly improves
development velocity, resilience, and scalability.

Kubernetes has become the industry standard for container orchestration. It was
originally developed by Google based on its internal system Borg and later open-
sourced. As per CNCF reports, Kubernetes adoption has increased dramatically across
organizations of all sizes due to its community support, portability, and extensibility.
Literature also suggests that combining Docker and Kubernetes provides an efficient
and portable solution for deploying microservices in both development and production
environments.

2
2. SYSTEM REQUIREMENTS

2.1 HARDWERE REQUIREMENTS:

➢ Processor – A multi-core processor (Intel i5 or AMD Ryzen 5 equivalent)

➢ RAM – Minimum 8 GB RAM is required to run Docker, Kubernetes (Minikube),


and development tools simultaneously.

➢ Storage – At least 20 GB of free disk space is required for images, containers, logs,
and Kubernetes configurations.

➢ Network – A stable internet connection is required for downloading Docker images,


pushing to Docker Hub, and fetching Minikube and package dependencies.

2.1 SOFTWARE REQUIREMENTS

➢ Operating System – Windows 10/11, Linux (Ubuntu 20.04+), or macOS. A Unix-


based system is preferred for better Docker and Kubernetes compatibility.

➢ Docker – Docker Desktop or Docker Engine is required to containerize the Node.js


microservice and manage images locally.

➢ Kubernetes (Minikube) – Minikube provides a lightweight Kubernetes cluster locally


for development and testing.

➢ kubectl – The command-line tool for interacting with the Kubernetes cluster, used
for applying deployments, checking pod statuses, and managing services.

➢ Node.js & npm – Required for developing and running the backend microservice.
Version 16.x or above is recommended.

➢ Text Editor or IDE – VS Code or any code editor to write and manage code
effectively.

3
➢ Browser – Google Chrome or Firefox for testing service accessibility via browser
endpoints.

➢ Docker Hub Account – Needed to push container images and access them from the
Kubernetes cluster during pod creation.

2.2 SOFTWARE REQUIREMENTS SPECIFICATION(SRS):

Functional Requirements:

 The system shall build and run a microservice using Node.js that responds to
HTTP requests.
 The system shall containerize the microservice using Docker and publish the
image to Docker Hub.
 The system shall deploy the microservice container using Kubernetes
Deployment and expose it using a Service.
 The system shall be accessible externally via Minikube IP and exposed
NodePort.

Non-Functional Requirements:

 The system should ensure consistent container behavior across different


environments.
 The Kubernetes service should be self-healing, automatically restarting failed
pods.
 The system should allow scaling by increasing replica count in the
Deployment.
 The system should keep resource usage optimal to run on a local machine
efficiently.

User Requirements:

 Users must have Docker and Minikube installed and configured.


 Users must be able to run commands using the terminal or command prompt.
 Users must have basic knowledge of Kubernetes commands and Docker
operations.

4
3. SYSTEM DESIGN
3.1 PROPOSED SYSTEM - MODULES OF SYSTEM
The proposed system utilizes containerization and orchestration principles to deploy a
microservice-based backend using Kubernetes. The system is modular, with each
component fulfilling a specific responsibility in the overall deployment lifecycle.
1. Node.js Microservice Module
This module serves as the core backend logic. A simple Express.js application
is developed to listen on a specific port and respond to HTTP requests. It contains the
business logic and acts as a sample REST API.
2. Docker Containerization Module
This module is responsible for packaging the Node.js application into a Docker
container. A Dockerfile defines the container environment, copies the source code,
installs dependencies, and specifies the command to start the server.
3. Docker Hub Integration Module
Once the container is built, this module involves tagging and pushing the image
to Docker Hub. This allows Kubernetes to later pull the image from a centralized
registry during deployment.
4. Kubernetes Deployment Module
This module defines a Deployment YAML configuration. It specifies the
Docker image to use, the number of replicas, container ports, and restart policies.
Kubernetes ensures the desired number of containers are always running.
5. Kubernetes Service Module
This module defines a Service YAML file to expose the deployed application
to external clients. A NodePort service type is used to allow access via
<minikube-ip>:<node-port>.
6. Minikube Cluster Environment
Minikube acts as a lightweight, local Kubernetes cluster that allows testing the
system in an isolated environment. It simulates a production-like cluster, ideal for
development and educational purposes.
These modules work together to demonstrate a typical containerized microservice
architecture running in a Kubernetes environment. Each component is loosely coupled
and can be independently scaled or replaced.compliance.

5
4. Implementation/Methodology
IMPLEMENTATION
The implementation of this system revolves around containerizing a simple
Node.js microservice and deploying it within a Kubernetes cluster. Below is an
explanation of each step involved in the process, from setting up the environment to
deploying the application.

index.js:
const http = require('http');
const url = require('url');
const port = 3000;

const server = http.createServer((req, res) => {


const reqUrl = url.parse(req.url, true);

// Home Route
if (reqUrl.pathname === '/' && req.method === 'GET') {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Welcome to the Kubernetes Microservice!');
}
// About Route
else if (reqUrl.pathname === '/about' && req.method === 'GET') {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('This is a simple microservice running on Kubernetes!');
}
// JSON Response Route
else if (reqUrl.pathname === '/api' && req.method === 'GET') {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ message: 'Hello from the API!', status: 'success' }));
}
// 404 Route
else {
res.writeHead(404, { 'Content-Type': 'text/plain' });
res.end('Page not found');
}
});

server.listen(port, () => {
console.log(`Server running on http://localhost:${port}`);
});

6
DockerFile:
FROM node:18
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "start"]
deployment.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: microservice-app
spec:
replicas: 1
selector:
matchLabels:
app: microservice-app
template:
metadata:
labels:
app: microservice-app
spec:
containers:
- name: microservice-app
image: <docker-hub-username>/microservice-app:latest
ports:
- containerPort: 3000

7
Service.yaml:
apiVersion: v1
kind: Service
metadata:
name: microservice-app-service
spec:
selector:
app: microservice-app
ports:
- protocol: TCP
port: 8080
targetPort: 3000
type: NodePort

4.2 Test Cases:

To ensure the system functions correctly, several test cases are executed throughout
the deployment process:

1. Container Build Test:


o Test Case: Verify that the Docker image can be built successfully.
o Expected Result: The build completes without errors, and the image is
tagged correctly.

docker build -t microservice-app:latest .

2. Container Run Test:


o Test Case: Verify that the Docker container can run locally and the
application is accessible.
o Expected Result: The application should be reachable at
http://localhost:3000.

docker run -d -p 8080:3000 --name microservice-app microservice-app:latest

3. Kubernetes Deployment Test:


o Test Case: Deploy the microservice in a Kubernetes cluster and verify
that the pod is running.

8
o Expected Result: The pod should be in Running status, and the
deployment should be scaled as defined in the deployment.yaml file.

kubectl apply -f deployment.yaml


kubectl get pods

4. Service Accessibility Test:


o Test Case: Verify that the Kubernetes service exposes the application
externally.
o Expected Result: The application should be accessible at
http://<minikube-ip>:<node-port>.

minikube service microservice-app-service --url

5. Stress Test:
o Test Case: Simulate a high number of requests to ensure that the
application can handle the load and that Kubernetes can scale the
deployment when needed.
o Expected Result: The application should scale without issues, and the
response time should remain stable under load.

Use tools like ab (Apache Benchmark) to simulate requests:

ab -n 1000 -c 10 http://<minikube-ip>:<node-port>/

5. EXPERIMENTAL RESULTS:

9
10
11
6. CONCLUSION
The implementation of a microservice architecture using Kubernetes presents a
significant advancement in how modern applications are developed, deployed, and
maintained. Through this project, a basic Node.js application was successfully
containerized using Docker and deployed on a Kubernetes cluster using Minikube. This
not only showcased the flexibility of microservices but also the powerful orchestration
capabilities of Kubernetes in managing containers at scale.

Microservice architecture allows individual services to be developed, deployed, and


scaled independently. This approach enhances modularity, makes fault isolation easier,
and supports the use of different technologies for different services. Kubernetes
complements this architecture by automating deployment, scaling, and operation of
application containers, thus reducing manual efforts and potential human error.

The entire lifecycle of the microservice—from coding, building the Docker image,
pushing it to Docker Hub, to deploying and exposing it using Kubernetes—was
automated and standardized. This increases development velocity and makes the system
more robust and production-ready.

12
References:
 Kelsey Hightower, Brendan Burns, and Joe Beda, “Kubernetes: Up and
Running”, O’Reilly Media, 2nd Edition, 2019.
 Docker Documentation, https://docs.docker.com
 Kubernetes Official Documentation, https://kubernetes.io/docs
 Node.js Documentation, https://nodejs.org/en/docs
 Minikube Documentation, https://minikube.sigs.k8s.io/docs
 Martin Fowler, "Microservices – a definition of this new architectural term",
https://martinfowler.com/articles/microservices.html.

13

You might also like