The Goal#
To create a portable, production-like Kubernetes playground that simulates real-world DevOps scenarios. This lab runs entirely locally using k3d but implements the same toolchain used in enterprise environments.
Key Architectures#
1. Event-Driven Autoscaling (KEDA)#
I implemented a pattern often found in high-scale systems: Queue-Based Scaling.
- The Flow: A 3-tier app publishes jobs to RabbitMQ.
- The Scaler: KEDA monitors the queue depth.
- The Action: Automatically scales worker pods from 0 to 10 based on load, then scales back to 0 when the queue is empty.
2. Full GitOps & CI/CD Pipeline#
Instead of simple kubectl apply, this lab enforces best practices:
- CI (Jenkins): Runs inside the cluster. I configured Kaniko agents to build Docker images securely (without needing the host Docker socket).
- CD (ArgoCD): Synchronizes the cluster state from the Git repository, ensuring the "Git is Truth" principle.
3. Observability Stack#
A complete monitoring stack is pre-configured to visualize the scaling events:
- Prometheus: Scrapes metrics from the application and Kubernetes components.
- Grafana: Visualizes the "Queue Depth vs. Pod Count" correlation, proving the autoscaling logic works.
- Loki: Aggregates logs from all microservices.
4. Resilience Testing#
The lab includes Chaos Testing scripts to validate the architecture, simulating:
- Pod deletions (verifying ReplicaSet recovery).
- Database outages (testing application retry logic).