A complete hands-on lab demonstrating how to monitor and troubleshoot Kubernetes workloads using Middleware.io.
This project simulates real-world Kubernetes issues — CrashLoopBackOff, OOMKilled, Pending, and Healthy — while showing how Middleware APM, OpsAI, and the K8s agent help you detect, analyze, and fix them.
| App Name | Description | Expected Status |
|---|---|---|
| restaurant-app | Healthy Node.js app (with Middleware APM) | ✅ Running |
| oom-app | Simulated Out-Of-Memory container | |
| crash-app | Faulty app for CrashLoopBackOff scenario | ❌ CrashLoopBackOff |
| pending-app | Deployment without available resources | ⏳ Pending |
- Node.js + Express
- Docker
- Minikube / Kubernetes
- Middleware.io Agent + OpsAI + APM
middleware-k8s-troubleshooting-lab/ ├── app/ # Node.js app with Middleware APM ├── k8s/ # Kubernetes manifests ├── docker/ # Docker configs (if needed) ├── opsai/ # Optional OpsAI configs └── scripts/ # Utility scripts
# 1️⃣ Point Docker to Minikube
eval $(minikube docker-env)
# 2️⃣ Build the app image inside Minikube
docker build -t restaurant-app:latest ./app
# 3️⃣ Apply all manifests
kubectl apply -f k8s/
# 4️⃣ Verify deployments
kubectl get deploy -n mw-demo
kubectl get pods -n mw-demo
Expected output:
crash-app 0/1 CrashLoopBackOff
oom-app 1/1 Running
pending-app 1/1 Running
restaurant-app 2/2 Running
🧪 Test the App (Optional)
# Port-forward the service
kubectl port-forward -n mw-demo svc/restaurant-app-svc 8080:80
# Login test
curl -X POST http://localhost:8080/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin"}'
# Trigger OpsAI error
curl http://localhost:8080/boom
📊 Validate in Middleware.io
Go to your Middleware dashboard → Kubernetes → Namespace: mw-demo
You should see:
✅ Running pods
⚠️ OOMKilled pod
❌ CrashLoopBackOff pod
⏳ Pending pod
Also check APM → restaurant-app for Node.js traces
and OpsAI → Errors for the /boom route exception.
🧠 Author
Mahendra Rao
Middleware.io | Pune, India
📎 LinkedIn
| 🐙 GitHub @MR2MW