CI Load Test for http-echo using Kind and k6
Source: Dev.to

Solution Overview
This project implements a comprehensive load‑testing solution using:
- Kind – creates a multi‑node Kubernetes cluster for realistic testing environments.
- NGINX Ingress Controller – routes HTTP requests to different services based on hostnames.
- k6 – performs load testing with detailed metrics and performance analysis.
Architecture
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ k6 Load Test │───▶│ NGINX Ingress │───▶│ http‑echo apps │
│ │ │ Controller │ │ │
│ - foo.localhost │ │ │ │ - foo service │
│ - bar.localhost │ │ (Port 80/443) │ │ - bar service │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
▼
┌──────────────────┐
│ Kind Cluster │
│ │
│ - Control plane │
│ - Worker node │
└──────────────────┘
Project Structure
kind-http-echo-test/
├── README.md # This documentation
├── kind-config.yaml # Kind cluster configuration
├── k8s/ # Kubernetes manifests
│ ├── http-echo-foo.yaml # Foo service deployment
│ └── http-echo-bar.yaml # Bar service deployment
└── loadtest/ # Load‑testing scripts
└── load-test.js # k6 load‑test script
Prerequisites
Ensure the following tools are installed in the CI environment:
CI Workflow
The project is intended for automated CI/CD pipelines that trigger on each pull request to the default branch. The workflow consists of four sequential stages.
Stage 1 – Environment Setup
Purpose: Prepare the CI runner with all necessary tools and dependencies (supports both AMD64 and ARM64 agents).
Key Activities
- Checkout the repository.
- Install the k6 load‑testing tool via the package manager.
- Download and install Kind for local Kubernetes clusters.
- Set up
kubectlfor cluster management. - Configure required permissions and environment variables.
Stage 2 – Cluster Provisioning
Purpose: Create and configure a complete Kubernetes environment for testing.
Key Activities
- Create a multi‑node Kind cluster using
kind-config.yaml. - Install the NGINX Ingress Controller for request routing.
- Wait for all control‑plane components to become ready.
- Deploy the
http‑echoapplications (foo and bar services). - Verify that all pods are running and services are reachable.
- Configure Ingress rules for hostname‑based routing.
Stage 3 – Load Testing
Purpose: Execute comprehensive load testing against the deployed services.
Key Activities
- Perform health‑check probes to verify endpoint availability.
- Run the k6 script (
load-test.js) with predefined scenarios. - Monitor real‑time performance metrics during the run.
- Generate detailed test results in JSON format.
- Capture custom metrics for both foo and bar services (response times, error rates, throughput).
Test Configuration
| Phase | Duration | Virtual Users | Purpose |
|---|---|---|---|
| Ramp‑up | 10 s | 0 → 10 | Gradual load increase to target load |
| Sustained | 30 s | 20 | Peak performance evaluation |
| Ramp‑down | 10 s | 20 → 0 | Graceful load reduction |
Performance Thresholds
- Ramp‑up: 10 s to reach target load
- Sustained load: 30 s at peak virtual users
- Ramp‑down: 10 s to zero load
- P95 response time
Reference: Goodnotes Take‑Home Assignment – DevOps Engineering
Note: The solution did not meet the team’s expectations.