-
Notifications
You must be signed in to change notification settings - Fork 1
Architecture
Welcome to the architecture documentation for the k8s-ephemeral-environments platform. This section provides comprehensive information about the system design, infrastructure components, and technical decisions that power ephemeral PR environments.
The platform creates isolated Kubernetes environments for each Pull Request, enabling developers to preview and test changes in a production-like setting before merging. Each environment includes the application, databases, and observability tooling, all automatically provisioned and destroyed with the PR lifecycle.
+------------------------------------------------------------------+
| Platform Architecture |
+------------------------------------------------------------------+
| |
| +------------------+ +------------------+ +--------------+ |
| | GitHub PR | | GitHub Actions | | k3s | |
| | (Trigger) |--->| (CI/CD) |--->| Cluster | |
| +------------------+ +------------------+ +--------------+ |
| | |
| v |
| +----------------------------------------------------------+ |
| | Ephemeral Namespace | |
| | +----------+ +----------+ +----------+ +----------+ | |
| | | App | | DB | | Redis | | MinIO | | |
| | | Pod | | Pod | | Pod | | Pod | | |
| | +----------+ +----------+ +----------+ +----------+ | |
| +----------------------------------------------------------+ |
| |
+------------------------------------------------------------------+
Detailed technical documentation covering:
- High-level architecture - Visual diagram of the complete system
- Namespace structure - How namespaces are organized (permanent vs ephemeral)
- Technology stack - All components and their justifications
- PR environment lifecycle - Step-by-step flow from PR open to close
- Resource quota system - Dynamic resource allocation based on database configuration
Planning documentation for Phase 2 migration:
- Current vs target architecture - k3s to EKS comparison
- Cluster-specific configurations - NetworkPolicy, PriorityClasses, storage
- Migration checklist - Step-by-step migration tasks
- Environment variables - Configuration differences between phases
| Principle | Implementation |
|---|---|
| Isolation | Each PR gets its own namespace with NetworkPolicies |
| Automation | Zero manual intervention for environment lifecycle |
| Observability | Full metrics, logs, and alerting for every environment |
| Cost efficiency | Automatic cleanup and resource quotas |
| Security | Network isolation, sealed secrets, minimal RBAC |
| Component | Phase 1 (Current) | Phase 2 (Future) |
|---|---|---|
| Kubernetes | k3s (single-node) | Amazon EKS (multi-node) |
| Infrastructure | Oracle Cloud VPS (ARM64) | AWS (Graviton or x86) |
| Ingress | Traefik (bundled) | AWS ALB or Traefik |
| Storage | Local Path Provisioner | EBS (gp3) |
| Database | CloudNativePG (in-cluster) | CloudNativePG or RDS |
Key decisions made during platform development:
- k3s over full Kubernetes - Lightweight, fast installation, ideal for single-node VPS
- CloudNativePG over external RDS - Complete isolation per PR, simplified lifecycle
- Helm over raw manifests - Flexible templating, large community ecosystem
- Local charts for PRs - Enables testing chart changes before publishing
- Dynamic quotas - Automatically calculated based on enabled databases
Note: The architecture is designed to be portable. Phase 2 migration to EKS requires minimal application changes, primarily infrastructure configuration updates.
- System-Overview - Detailed system architecture documentation
- EKS-Migration-Guide - Migration planning for Amazon EKS
- Configuration-Reference - k8s-ee.yaml schema and options
- Service-Development - Best practices for service implementation
- Home - Documentation home page
Getting Started
User Guides
- Database Setup
- Database Migrations
- Database Seeding
- Service Development
- Security and Access Control
- On-Demand Environments
- Alternative CI Integration
Troubleshooting
Operations
- VPS Access
- K3s Operations
- ARC Runner Management
- Cleanup Job
- Preserve Environment
- Grafana Dashboards
- Cluster Recovery
Architecture
Demo Applications
Development