Kubernetes Task Manager - Technical Documentation
Project Purpose
This project demonstrates a production-like Kubernetes deployment featuring:
- Multi-container application
 
- Persistent storage
 
- Scalable frontend
 
- Proper resource management
 
Deployment Components
Core Objects
| Object Type | 
Name | 
Purpose | 
Namespace | 
web-app | 
Isolates all application resources | 
Deployment | 
web-app | 
Manages 2 replicas of frontend pods | 
StatefulSet | 
mysql | 
Manages database pod with stable network identity | 
| Service         | web-app-service   | Exposes frontend on NodePort 30080                                     |
| PersistentVolume| mysql-pv          | Provides 5Gi storage for database                                      |
Container Images
| Component | 
Image | 
Port | 
Notes | 
| Frontend | 
k8s-task-manager-frontend | 
80 | 
Custom-built Nginx image | 
| Database | 
mysql:5.7 | 
3306 | 
With preconfigured credentials | 
| Backend | 
k8s-task-manager-api | 
8080 | 
Node.js/Express REST API | 
Deployment Workflow
graph TD
    A[prepare-app.sh] --> B[Creates PV directories]
    B --> C[Builds frontend image]
    C --> D[start-app.sh]
    D --> E[Creates Namespace]
    E --> F[Deploys PV/PVC]
    F --> G[Deploys MySQL StatefulSet]
    G --> H[Deploys Frontend]
    H --> I[Creates Service]
# Key Configuration Details
## Resource Allocation
Frontend:
resources:
  requests:
    cpu: "100m"
    memory: "128Mi"
  limits:
    cpu: "250m"
    memory: "256Mi"
Database:
resources:
  requests:
    cpu: "500m"
    memory: "512Mi"
  limits:
    cpu: "1000m"
    memory: "1Gi"
Backend:
```yaml
resources:
  requests:
    cpu: "200m"
    memory: "256Mi"
  limits:
    cpu: "500m"
    memory: "512Mi"
Storage Configuration
# persistentvolume.yaml
spec:
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data/mysql"
# Operational Procedures
## Accessing the Application
Local Development:
minikube service web-app-service -n web-app
Production Access:
http://<node-ip>:30080
Monitoring Commands:
# Check pod status
kubectl get pods -n web-app -w
# View frontend logs
kubectl logs -n web_app deploy/web-app -f
# Verify database health
kubectl exec -n web-app mysql-0 -- mysql -uroot -ppassword -e "SHOW DATABASES;"
# Maintenance Tasks
Scaling Frontend:
kubectl scale -n web-app deployment/web-app --replicas=3
Database Backup:
kubectl exec -n web-app mysql-0 -- \
  mysqldump -u root -ppassword taskmanager > backup_$(date +%F).sql
# Security Notes
Database Credentials:
Default credentials are for demonstration only
In production, use:
envFrom:
- secretRef:
    name: mysql-credentials
Network Exposure:
Current: NodePort (30080)
Recommended: Ingress with TLS termination
# Troubleshooting Guide
Symptom	                        Diagnostic Steps        	        Resolution
Frontend not responding	kubectl get svc -n web-app	                Verify NodePort configuration
Database pod crash loops	kubectl describe pod mysql-0 -n web-app	Check storage permissions
High CPU usage	                kubectl top pods -n web-app      	Adjust resource limits
Cleanup Procedure
# Full uninstall
./stop-app.sh
# Optional: Remove persistent data
sudo rm -rf /mnt/data/mysql