A visual Kubernetes lab for inspecting cluster state, understanding resource relationships, and reproducing Kubernetes failure scenarios.
K8lab is a Kubernetes visualization and experimentation platform that provides a higher-level interface over the Kubernetes API.
It brings resource inspection, topology visualization, workload state, experiment execution, logs, and operational activity into a single interface, while keeping the underlying Kubernetes objects and their behaviour visible.
The project is designed around a simple idea: make Kubernetes
behaviour observable and reproducible without requiring every interaction
to begin with a kubectl command.
Working with Kubernetes often requires correlating information from multiple sources: resource specifications, object relationships, container states, events, logs, and controller behaviour.
K8lab provides a visual layer over these primitives so that this information can be inspected together rather than reconstructed manually from individual commands.
The experimentation layer extends this further by allowing common Kubernetes failure modes to be reproduced on demand, making the resulting Kubernetes state directly observable.
- Connect to configured Kubernetes clusters
- Switch between available clusters
- View cluster health and workload statistics
- Inspect cluster-level activity
- Use the selected cluster as the execution context for resource and experiment operations
The Resources page provides an inventory view over Kubernetes objects.
- Browse workloads and Kubernetes resources
- Filter resources by resource type
- Inspect resource metadata and status
- View detailed resource information
- Inspect generated YAML representations
- Delete resources directly from the interface
The topology service transforms Kubernetes resources into a graph representation consumed by the frontend.
Relationships between resources such as:
Node
βββ Deployment
βββ ReplicaSet
βββ Pod
βββ Container
can be explored visually alongside networking resources such as Services and Ingresses.
The frontend uses React Flow to provide interactive graph navigation
The experiment subsystem provides reproducible scenarios for common Kubernetes lifecycle and scheduling failures.
| Experiment | Kubernetes behaviour |
|---|---|
| CrashLoopBackOff | Container repeatedly terminates and is restarted |
| ImagePullBackOff | Container image cannot be pulled |
| OOMKilled | Container exceeds its memory limit |
| Pending Pod | Pod cannot be scheduled due to resource requirements |
| Failed Liveness Probe | Kubelet repeatedly restarts an unhealthy container |
Each execution receives a unique runID and is associated with the target cluster and experiment.
The backend uses Kubernetes labels to isolate resources belonging to a particular execution:
k8lab.io/experiment=<experiment-id>
k8lab.io/run=<run-id>
This allows resources created by different experiment runs to be identified, monitored, stopped, and removed independently.
Experiment execution is asynchronous. The backend creates the Kubernetes resources and immediately returns an ExperimentRun. The frontend then polls the logs endpoint while the experiment is active.
The returned log stream combines:
- Experiment-level messages generated by the backend
- Raw Kubernetes container logs retrieved through the Kubernetes API
Polling stops automatically when the run reaches a terminal state.
Important operations are recorded through the activity service rather than directly writing to the database from individual handlers.
Cluster operation
β
Domain Service
β
recordActivity()
β
Activity Service
β
MySQL
This provides a consistent activity trail for cluster operations, resource operations, and experiment lifecycle events.
K8lab follows a layered frontend β API β service β infrastructure architecture.
flowchart LR
User[User]
subgraph Frontend["React + Vite"]
UI[React UI]
Store[Zustand Store]
Hooks[Custom Hooks]
Services[API Services]
end
subgraph Backend["Go Backend"]
Router[HTTP Router]
Handlers[HTTP Handlers]
Cluster[Cluster Service]
Resource[Resource Service]
Topology[Topology Service]
Experiment[Experiment Service]
Activity[Activity Service]
end
K8s[(Kubernetes API)]
MySQL[(MySQL)]
User --> UI
UI --> Hooks
Hooks --> Store
Store --> Services
Services --> Router
Router --> Handlers
Handlers --> Cluster
Handlers --> Resource
Handlers --> Topology
Handlers --> Experiment
Cluster --> K8s
Resource --> K8s
Topology --> K8s
Experiment --> K8s
Cluster --> Activity
Resource --> Activity
Topology --> Activity
Experiment --> Activity
Activity --> MySQL
React Component
β
Custom Hook
β
Zustand Store
β
Frontend Service
β
Go HTTP Handler
β
Domain Service
β
Kubernetes client-go
β
Kubernetes API Server
Start Experiment
β
POST /api/clusters/{clusterId}/experiments/{experimentId}/run
β
Experiment Service
β
Create ExperimentRun
β
KubernetesRunner.Run()
β
Create Kubernetes resources
β
Return runID
β
Frontend polling
β
GET /api/clusters/{clusterId}/experiments/runs/{runId}/logs
β
ExperimentService.GetLogs()
β
KubernetesRunner.Logs()
β
Kubernetes API
β
Status + experiment messages + pod logs
β
Frontend
| Layer | Technology |
|---|---|
| Frontend | React, TypeScript, Vite |
| State | Zustand |
| Styling | Tailwind CSS |
| Routing | React Router |
| Visualization | React Flow |
| Backend | Go, net/http |
| Kubernetes | Kubernetes client-go |
| Database | MySQL |
| Data | JSON / YAML |
| Development | Make, Git |
k8lab/
βββ README.md
βββ Makefile
βββ backend/
β βββ Makefile
β βββ go.mod
β βββ cmd/
β β βββ server/
β β βββ main.go
β βββ internal/
β βββ activity/
β βββ api/
β βββ cluster/
β βββ config/
β βββ database/
β βββ experiment/
β βββ resource/
β βββ topology/
βββ frontend/
β βββ Makefile
β βββ package.json
β βββ vite.config.ts
β βββ index.html
β βββ public/
β βββ src/
β βββ App.tsx
β βββ components/
β βββ constants/
β βββ data/
β βββ hooks/
β βββ layouts/
β βββ pages/
β βββ routes/
β βββ services/
β βββ store/
β βββ styles/
β βββ types/
β βββ utils/
βββ .gitignore
- Node.js 18+
- Go 1.26+
- MySQL
- A Kubernetes cluster
- A valid Kubernetes kubeconfig
git clone <repository-url>
cd k8labcd frontend
npm install
npm run devFrontend:
http://localhost:5173
In another terminal:
cd backend
##Set the MySQL connection string:
export K8LAB_MYSQL_DSN="user:password@tcp(localhost:3306)/k8lab?parseTime=true"
##Run database migrations
##Create the database if it does not already exist:
##The backend uses the available Kubernetes kubeconfig to connect to the target cluster.
mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS k8lab;"
##Apply the initial migration:
mysql -u root -p k8lab < internal/database/migrations/001_create_activities.up.sql
go run ./cmd/serverBackend will be available at:
http://localhost:8080
From the project root:
make frontend
make backend
make build
Built with React, Go, Kubernetes, and a lot of kubectl debugging.