Project Name

Modernise Healthcare Industry Operations with Springboot and Kubernetes

Industry
Healthcare
Technology
Java, Springboot, MySQL, and Docker

Overview

Our client belongs to the medical industry and is looking for a way to streamline business operations and increase customer satisfaction. They were completely focused on modernizing their business infrastructure and were looking for the right technology solution for implementation, which helped them optimize various aspects of their services.

healthcare-overview

Challenges

Our client faced several challenges inherent in their industry and infrastructure, including:

healthcare-challenges
  • There were difficulties in managing communication and coordination between microservices that brought complexity to their distributed system.
  • Another major complex issue arises while securing microservices and implementing the authentication and authorization mechanisms.
  • Deployment and orchestration of microservices becomes a daunting task for the client’s team.

Our Solution

After addressing these challenges faced by a client, the Ksolves team had to provide a comprehensive solution that leverages the advanced technologies mentioned below in a few steps:

  • For service coordination and communication, our team implemented a service registry using Netflix Eureka for instant service discovery.
  • They utilized reliable messaging systems like Apache Kafka for event-driven communication between service providers and then integrated Spring Cloud for common communication patterns.
  • For security and authentication, our team implemented OAuth 2.0 for vigorous authentication and authorization.
  • The Ksolves team took a step further and utilized API gateways and Spring Security to manage the security at the end of the microservices architecture. Then, we employed JWT (JSON Web Tokens) for stateless authentication that ensures enhanced security measures.
  • For the deployment and orchestration phase, we used containerized microservices using Docker and leveraged Kubernetes for automated deployment and management of applications.
  • At last, it becomes possible for our client to explore serverless computing to enhance scalability and resource efficiency.

Implementation Process:

Containerization of Spring Boot Applications

To containerize Spring applications, I used Docker. Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so that you can deliver software quickly.To containerize the Springboot application, we must first create its Jar file. To create a jar file, we write a Docker file for it.

A sample DockerFile content looks like this

FROM openjdk:17-oracle

ARG JAR_FILE=target/*.jar

COPY ${JAR_FILE} app.jar

ENTRYPOINT [“java”,”-jar”,”/app.jar”]

Now to create jar, We will use maven.

Run Command:

mvn clean install -DskipTests.

This will generate a jar file of the spring app in the target folder.

Now to containerize this app we will write a docker compose file for it.

A sample docker compose file Configuration looks like this:

Docker-compose.yml

version: ‘3.8’

services:

userservice:

build: .

ports:

‐ “8081:8081”

depends_on:

‐ mysqldb

networks:

‐ backend

mysqldb:

image: mysql

restart: always

container_name: mysqldb

ports:

‐ 3306:3306

expose:

‐ 3306

volumes:

‐ mysql-vol:/var/lib/mysql

networks:

‐ backend

environment:

MYSQL_DATABASE: mydb

MYSQL_ROOT_PASSWORD: mypassword

MYSQL_USER: myuser

MYSQL_PASSWORD: mypassword

volumes:

mysql-vol:

networks:

backend:

Now to build docker image, we will go into directory of that file and

Run command: docker compose up -d

This will build a docker image of the application and also start a container of it.

To see images we can use the command:

Run command: docker images

Now add a tag to docker images.

Run the command: docker tag imageName:tagName

Now we have to push these images to docker hub.

To push these images to the docker hub.

First, we need to log into the docker hub account.

Run command:

docker login -u username

Enter password:

Now to push image to dockerhub:

Run command: docker push your-docker-username/your-image-name:your-tag

Deployment in Kubernetes:

For deployment, I used the inbuilt Kubernetes environment provided by docker desktop.To deploy these applications into Kubernetes We have to create a .yaml file.

A sample deployment file will look like this:

deployUserService.yaml

# Deployment configuration

apiVersion: apps/v1

kind: Deployment

metadata:

name: serviceregistry

spec:

replicas: 3

selector:

matchLabels:

app: serviceregistry

template:

metadata:

labels:

app: serviceregistry

spec:

containers:

‐ name: serviceregistry

image: rahulsharma1103/kubernetes_case_study:serviceregistry

ports:

‐ containerPort: 8761

‐‐‐

# Service configuration

apiVersion: v1

kind: Service

metadata:

name: serviceregistry-service

spec:

selector:

app: serviceregistry

ports:

‐ protocol: TCP

port: 80

targetPort: 8761

type: NodePort # Change this line to NodePort

To deploy this application run command got to directory of that file and

Run command:

kubectl apply -f your-deployment-file.yaml

Some other useful commands of kubernetes:

1. To see all deployments:

kubectl get deployments

2. To see details of a deployed application:

kubectl describes deployment sample-deployment

3. To see the status of pods:

kubectl get pods

4. To see the status of the particular pod:

kubectl describe pod <pod-name>

5. To delete a deployment:

kubectl delete deployment sample-deployment

6. If you want to delete all resources created by the deployment, including

pods, you can use the ‐‐all flag:

kubectl delete deployment sample-deployment ‐‐all

Conclusion

By embracing the microservices architecture and leveraging cutting-edge tools like Spring Boot, Kubernetes, and Docker, it becomes possible for our client to improve the business infrastructure and deliver enhanced customer experiences. However, with the strategic implementation of Spring application solutions with customization, it becomes convenient for our clients to instantly navigate the complexities of their medical industry with the right confidence and agility. This deployment in Kubernetes not only signifies the commitment to innovation but also brings the right dedication to drive value for our clients in this landscape of technology and business.

Streamline Your Business Operations With Our
DevOps Application Customisation Solutions!