Skip to content

MR2MW/middleware-k8s-troubleshooting-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚙️ Middleware Kubernetes Troubleshooting Lab 🚀

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.


🧩 Project Overview

App Name Description Expected Status
restaurant-app Healthy Node.js app (with Middleware APM) ✅ Running
oom-app Simulated Out-Of-Memory container ⚠️ OOMKilled / Restarting
crash-app Faulty app for CrashLoopBackOff scenario ❌ CrashLoopBackOff
pending-app Deployment without available resources ⏳ Pending

🛠️ Stack

  • Node.js + Express
  • Docker
  • Minikube / Kubernetes
  • Middleware.io Agent + OpsAI + APM

🧱 Folder Structure

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


⚙️ How to Run Locally (Minikube)

# 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

About

Initial lab with k8s + minikube steps + OpsAI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors