A production-ready Java web calculator application demonstrating real-world DevOps practices, including CI/CD with Jenkins, Docker containerization, and Kubernetes orchestration.
- WebCal DevOps Project
- Table of Contents
- Introduction
- Features
- Screenshot
- Tech Stack
- Architecture Overview
- Project Structure
- Prerequisites
- Step 1: Build Maven Project
- Step 2: Build Docker Image
- Step 3: Apply Kubernetes Manifests
- Step 4: Verify Deployments
- Step 5: Configure Hosts File
- Step 6: Access the App (Ingress)
- CI/CD (Jenkins)
- Step 7: Common Issues & Fixes
- Project Notes
- π€ About the Architect
This project is a Java Servlet + JSP calculator application, containerized with Docker, deployed on Kubernetes with ClusterIP + Ingress, and automated via Jenkins CI/CD pipeline. It demonstrates full DevOps best practices including automated deployments, rollback on failures, and namespace isolation.
- Simple web-based calculator (addition, subtraction, multiplication, division)
- Dockerized Java application
- Kubernetes deployment with ClusterIP Service and Ingress
- CI/CD pipeline with Jenkins
- Fully namespaced Kubernetes resources
- Automatic image tagging using Git commit hash
- Rollback support on failed deployments
- Backend: Java Servlets + JSP
- Build Tool: Maven
- Containerization: Docker
- Orchestration: Kubernetes (ClusterIP + Ingress)
- CI/CD: Jenkins
- Registry: Docker Hub (
mayrhatte09)
User β Browser
β
Ingress (NGINX)
β
βββββββββββββββ
β WebCal App β
β Java Servletβ
βββββββββ¬ββββββ
β
Kubernetes Cluster
(Namespace: k8s)
β
Docker Containers
CI/CD Flow:
GitHub β Jenkins β Docker β Docker Hub β Kubernetes (EKS/Minikube)
webcal-project/
βββ Jenkinsfile
βββ dockerfile
βββ pom.xml
βββ kubernetes/
βββ namespace.yaml
βββ deployment.yaml
βββ service.yaml
βββ ingress.yaml
βββ src/
βββ main/
βββ java/com/example/CalculatorServlet.java
βββ webapp/
βββ WEB-INF/web.xml
βββ index.jsp
βββ result.jsp
- Java 11+
- Maven
- Docker & Docker Hub account (
mayrhatte09) - Kubernetes cluster (Minikube, Kind, or AWS EKS)
- kubectl configured
- Jenkins server with Docker access
- NGINX Ingress Controller for routing
mvn clean packageGenerates target/webcal.war file.
docker build -t mayrhatte09/webcal:latest .
docker tag mayrhatte09/webcal:latest mayrhatte09/webcal:<git-commit-hash>
docker push mayrhatte09/webcal:latest
docker push mayrhatte09/webcal:<git-commit-hash>- Apply namespace:
kubectl apply -f kubernetes/namespace.yaml- Apply deployment, service, and ingress:
kubectl apply -f kubernetes/deployment.yaml -n k8s
kubectl apply -f kubernetes/service.yaml -n k8s
kubectl apply -f kubernetes/ingress.yaml -n k8sCheck pods:
kubectl get pods -n k8sCheck services:
kubectl get svc -n k8sCheck ingress:
kubectl get ingress -n k8sExample output:
NAME CLASS HOSTS ADDRESS PORTS AGE
webcal <none> webcal.local 127.0.0.1 80 1m
Tip for Minikube users: If
ADDRESSis<pending>, run:minikube ipUse the Minikube IP in the hosts file instead of
127.0.0.1.
Map ingress host webcal.local to localhost.
- Open
C:\Windows\System32\drivers\etc\hostsas Administrator - Add line:
127.0.0.1 webcal.local
- Flush DNS:
ipconfig /flushdns- Edit
/etc/hosts:
sudo nano /etc/hosts- Add line:
127.0.0.1 webcal.local
- Flush DNS:
sudo dscacheutil -flushcache- Edit hosts file:
sudo nano /etc/hosts- Add line:
127.0.0.1 webcal.local
If using Minikube:
<minikube-ip> webcal.local
- Flush DNS if caching is enabled:
Systemd DNS (Ubuntu 18.04+):
sudo systemd-resolve --flush-cachesNSCD (if installed):
sudo service nscd restart- Verify mapping:
ping webcal.local
# Should return 127.0.0.1 (or Minikube IP)- Open browser: http://webcal.local
- Use the calculator for basic operations.
- Git push triggers Jenkins pipeline
- Jenkins builds Maven project & runs tests
- Docker image is built & pushed to Docker Hub
- Kubernetes namespace is created if not exists
- Deployment, Service, and Ingress applied
- Rollback occurs automatically if deployment fails
| Issue | Fix |
|---|---|
| Pod not running | Check kubectl get pods -n k8s and logs |
| Ingress not working | Ensure NGINX Ingress controller installed |
| ImagePullBackOff | Verify Docker image exists in Docker Hub |
| Wrong namespace | Use -n k8s in all kubectl commands |
| Port not accessible | Verify containerPort in deployment and service |
| Jenkins pipeline failed | Check Jenkins console logs |
| Hosts not resolving | Update /etc/hosts or flush DNS |
| Deployment not updating | Check image tag in deployment.yaml |
- All Kubernetes resources are namespaced under
k8s - Docker image tagging uses Git commit hash + latest
- Rollback enabled in Jenkins pipeline
- Fully modular for local (Minikube) or cloud (EKS) deployment
|
Mayur Hatte
DevOps & Cloud Infrastructure Engineer
Focused on building self-healing, automated infrastructure. Verified asset of MayurHatte09. |


