Assignment Chef icon Assignment Chef
All English tutorials

Programming lesson

Deploying a Multi-Tier Healthcare App on Kubernetes: A Step-by-Step Guide

Learn how to deploy a healthcare microservices application on Kubernetes using Docker, kubectl, and REST APIs. Step-by-step tutorial covering database, microservice, webapp, and REST service deployments with health checks and data operations.

Kubernetes deployment tutorial healthcare microservices Kubernetes CS 548 assignment nine deploy Docker image Kubernetes kubectl describe service kubectl logs microservice health checks Kubernetes REST API Kubernetes deployment add data via REST client Kubernetes multi-tier app Kubernetes enterprise software architecture Kubernetes assignment help patient provider treatment Kubernetes Kubernetes database deployment microservices health check endpoints

Introduction: Why Kubernetes for Enterprise Healthcare Apps?

In 2026, healthcare applications demand high availability, scalability, and security. Kubernetes has become the de facto orchestrator for deploying microservices in the cloud. This tutorial walks you through deploying a multi-tier healthcare system on Kubernetes, inspired by the CS 548 assignment. You'll learn to launch Docker containers as pods, expose services, check health endpoints, and perform CRUD operations via a REST client. By the end, you'll have a working patient-provider-treatment management system running on your cluster.

Prerequisites

  • A running Kubernetes cluster (minikube or cloud-based)
  • kubectl installed and configured
  • Docker installed (for building images)
  • IntelliJ IDEA with Database tool (or any SQL client)
  • Basic knowledge of Docker, Kubernetes, and REST APIs

Step 1: Create Database Docker Image, Deployment & Service

1.1 Build the Database Image

Create a Dockerfile for PostgreSQL (or MySQL) with initial schema. Example:

FROM postgres:15
ENV POSTGRES_DB=healthcare
ENV POSTGRES_USER=admin
ENV POSTGRES_PASSWORD=secret
COPY init.sql /docker-entrypoint-initdb.d/

Build and push to your registry:

docker build -t myrepo/healthcare-db:1.0 .
docker push myrepo/healthcare-db:1.0

1.2 Deploy the Database

Create db-deployment.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: healthcare-db
spec:
  replicas: 1
  selector:
    matchLabels:
      app: healthcare-db
  template:
    metadata:
      labels:
        app: healthcare-db
    spec:
      containers:
      - name: db
        image: myrepo/healthcare-db:1.0
        ports:
        - containerPort: 5432
        env:
        - name: POSTGRES_DB
          value: healthcare
        - name: POSTGRES_USER
          value: admin
        - name: POSTGRES_PASSWORD
          value: secret

Apply and create a service:

kubectl apply -f db-deployment.yaml
kubectl expose deployment healthcare-db --type=ClusterIP --port=5432 --name=db-service

1.3 Verify Database

Describe the service:

kubectl describe service db-service

Check logs:

kubectl logs deployment/healthcare-db

Connect via IntelliJ Database tool using the service DNS name (e.g., db-service.default.svc.cluster.local) and port 5432. Run SELECT * FROM patients; to see tables created by init.sql.

Step 2: Deploy the Microservice

2.1 Build Microservice Image

Assume a Spring Boot microservice that connects to the database. Dockerfile:

FROM openjdk:17-jdk-slim
COPY target/microservice.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]

Build and push.

2.2 Deploy and Expose

Create microservice-deployment.yaml with environment variables for DB connection. Expose as ClusterIP service.

Describe service:

kubectl describe service microservice-service

Check logs:

kubectl logs deployment/microservice

2.3 Test Query Operations

Port-forward to access locally:

kubectl port-forward service/microservice-service 8080:8080

Open browser: http://localhost:8080/patients should return JSON list.

2.4 Health Checks

Add liveness and readiness probes in deployment YAML:

livenessProbe:
  httpGet:
    path: /actuator/health
    port: 8080
readinessProbe:
  httpGet:
    path: /actuator/health
    port: 8080

Check health endpoint: http://localhost:8080/actuator/health returns {"status":"UP"}.

Step 3: Deploy the Web Application

3.1 Build Webapp Image

Assume a React or Angular frontend that calls the microservice. Dockerfile with nginx to serve static files. Build and push.

3.2 Deploy and Expose

Create deployment and service (type: LoadBalancer or NodePort). Describe service:

kubectl describe service webapp-service

3.3 Verify Webapp Works

Access via browser (e.g., http://localhost:3000 after port-forward). The webapp should display patient list fetched from microservice. Check logs:

kubectl logs deployment/webapp

You should see log entries indicating API calls to the microservice.

Step 4: Deploy REST Web Service

4.1 Build REST Service Image

Create a separate RESTful API (maybe in Node.js or another Spring Boot app) that provides endpoints for adding patients, providers, and treatments.

4.2 Deploy and Expose

Create deployment and service. Describe service:

kubectl describe service rest-service

4.3 Test Query Operations

Port-forward and test via browser:

  • GET /api/patients
  • GET /api/providers
  • GET /api/treatments

Check logs:

kubectl logs deployment/rest-service

Step 5: Add Data via REST Client

Use a REST client (Postman, curl) to add entities:

curl -X POST http://localhost:8081/api/patients -H "Content-Type: application/json" -d '{"name":"John Doe","age":30}'
curl -X POST http://localhost:8081/api/providers -d '{"name":"Dr. Smith","specialty":"Cardiology"}'
curl -X POST http://localhost:8081/api/treatments -d '{"patientId":1,"providerId":1,"description":"Checkup"}'

Verify data appears in the web application by refreshing the browser. Also check database tables via IntelliJ.

Step 6: Complete Rubric Checklist

  • [15] Database image, deployment, service described, logs shown, tables verified via IntelliJ.
  • [20] Microservice deployment, service described, logs shown, query operations tested, health checks verified.
  • [20] Webapp deployment, service described, webapp works, logs show backend usage.
  • [15] REST service deployment, service described, query operations tested, logs shown.
  • [25] Patients, providers, treatments added via REST client and visible in webapp.

Conclusion

You have successfully deployed a multi-tier healthcare application on Kubernetes. This setup mirrors real-world enterprise architectures where scalability and resilience are critical. By mastering these steps, you're ready to tackle more complex deployments with service meshes, CI/CD pipelines, and auto-scaling. Keep experimenting with Kubernetes—it's the backbone of modern cloud-native apps.