A complete MLOps pipeline implementation featuring automated Kubernetes cluster provisioning, ingress management, service deployment, health validation, and load testing with GitHub Actions CI/CD integration.
This project implements a comprehensive MLOps pipeline that automatically:
- Provisions multi-node Kubernetes clusters using KinD
- Deploys NGINX ingress controller for HTTP traffic management
- Creates and manages HTTP echo services (foo/bar)
- Validates service health and connectivity
- Performs automated load testing with k6
- Reports results via GitHub PR comments
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ GitHub PR │───▶│ GitHub Actions │───▶│ KinD Cluster │
│ Trigger │ │ Workflow │ │ (3 nodes) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
▲ │ │
│ │ ▼
│ │ ┌─────────────────┐
│ │ │ Ingress + Apps │
│ │ │ foo/bar services│
│ │ └─────────────────┘
│ │ │
│ ▼ ▼
│ ┌──────────────────┐ ┌─────────────────┐
│ │ Load Testing │───▶│ Results │
│ │ (k6) │ │ Collection │
│ └──────────────────┘ └─────────────────┘
│ │
│ ▼
│ ┌─────────────────┐
│ │ Performance │
│ │ Metrics │
│ └─────────────────┘
│ │
└────────────────────────────────────────────────┘
PR Comments
✅ Task 1: GitHub Actions CI workflow triggered on PR
✅ Task 2: Multi-node Kubernetes cluster provisioning (3 nodes)
✅ Task 3: NGINX Ingress controller deployment
✅ Task 4: HTTP-echo deployments (foo/bar services)
✅ Task 5: Ingress routing configuration (foo.localhost/bar.localhost)
✅ Task 6: Health validation and connectivity testing
✅ Task 7: Automated load testing with k6
✅ Task 8: PR comment automation with results reporting
- Docker
- kubectl
- KinD (Kubernetes in Docker)
- GitHub repository with Actions enabled
Clone the repository
git clone
cd
Make scripts executable
chmod +x scripts/*.sh
Run the complete pipeline locally
bash /scripts/provision-cluster.sh
bash /scripts/deploy-ingress.sh
bash /scripts/test-ingress.sh
bash /scripts/load-test.sh
- Create a pull request to
mainbranch - GitHub Actions will automatically trigger the MLOps pipeline
- Monitor progress in the Actions tab
- View automated results in PR comments
├── .github/workflows/
│ └── mlops-pipeline.yml # Main CI/CD workflow
├── config/
│ └── kind-cluster.yaml # Kubernetes cluster configuration
├── scripts/
│ ├── provision-cluster.sh # Cluster provisioning automation
│
├── deploy-ingress.sh # Ingress and services deployment
│
├── test-ingress.sh # Health validation testing
│
└── load-test.sh # k6 load testing execution
|
├── load-test-results/ # Generated test artifacts
|
└── README.md # This documentation
- Nodes: 1 control-plane + 2 workers
- Port Mappings: 80, 443, 30080, 30081
- Network: Pod subnet 10.244.0.0/16, Service subnet 10.96.0.0/12
CLUSTER_NAME=mlops-test-cluster # Kubernetes cluster name
NODE_READY_TIMEOUT=300 # Node readiness timeout (seconds)
VUS=10 # Virtual users for load testing
DURATION=30s # Load test duration
- Creates 3-node KinD cluster with proper networking
- Validates node readiness and system pod health
- Performs DNS functionality testing
- Implements retry logic with exponential backoff
- Deploys NGINX ingress controller
- Creates foo/bar HTTP echo services
- Configures ingress routing rules
- Waits for deployment readiness
- Tests ingress controller health
- Validates service endpoints
- Performs HTTP connectivity testing
- Comprehensive error reporting
- Deploys k6 load testing job in Kubernetes
- Generates randomized traffic to foo/bar services
- Collects performance metrics (response time, error rate, throughput)
- Creates detailed test reports
The load testing captures:
- Response Time: Average, 95th percentile
- Throughput: Requests per second
- Error Rate: Percentage of failed requests
- Success Rate: Percentage of successful requests
- Response time (95th percentile) < 500ms
- Error rate < 10%
- All services must be healthy before testing
- Pull request opened/updated to
mainbranch - Manual workflow dispatch
- Setup: Checkout code, install dependencies
- Provision: Create and validate Kubernetes cluster
- Deploy: Install ingress controller and services
- Test: Validate health and connectivity
- Load Test: Execute performance testing
- Report: Post results to PR comments
- Cleanup: Upload artifacts and logs
- Load test results and metrics
- Cluster debug logs (on failure)
- Performance reports in HTML/JSON format
- Real-time pipeline status in PR comments
- Detailed performance metrics
- Infrastructure configuration summary
- Service endpoint validation results
- Comprehensive logging at each stage
- Artifact collection for post-mortem analysis
- Cluster state snapshots on failure
- Create test script in
scripts/directory - Add execution step to
.github/workflows/mlops-pipeline.yml - Update documentation
- Modify
load-test-results/load-test.jsfor different scenarios - Adjust VUS and DURATION environment variables
- Add custom metrics and thresholds
- Add new deployments in
deploy-ingress.sh - Configure additional ingress routes
- Update health validation in
test-ingress.sh
- Cluster provisioning timeout: Increase
NODE_READY_TIMEOUT - Ingress not responding: Check port mappings in kind-cluster.yaml
- Load test failures: Verify service endpoints are accessible
- Script permissions: Ensure scripts are executable (
chmod +x)
Check cluster status kubectl get nodes -o wide kubectl get pods –all-namespaces Verify ingress kubectl get ingress kubectl describe ingress echo-ingress Test connectivity curl -H “Host: foo.localhost” http://localhost/ curl -H “Host: bar.localhost” http://localhost/
- Infrastructure as Code: Declarative YAML configurations
- Immutable Infrastructure: Container-based deployments
- Progressive Validation: Step-by-step health checks
- Fail-Fast Approach: Early error detection and reporting
- Automated Testing: Comprehensive validation pipeline
- Continuous Integration: PR-triggered workflows
- Observability: Detailed metrics and logging
- Reproducibility: Consistent environment provisioning
- Error Handling: Graceful failure management
- Documentation: Comprehensive inline comments
- Modularity: Separate scripts for distinct functions
- Maintainability: Clear separation of concerns
- KinD: Kubernetes in Docker for local cluster provisioning
- NGINX Ingress: Production-grade ingress controller
- k6: Modern load testing framework
- GitHub Actions: CI/CD automation platform
Project Status: ✅ Production Ready
Last Updated: May 28, 2025
Pipeline Version: v1.0.0
Time taken : Around 4-5 hours