Skip to content

sysadmin-exe/k8s-load-test-suite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoodNotes Challenge

Github Duration: 4hrs, 32 mins A complete Kubernetes infrastructure solution featuring a multi-node KinD cluster, HTTP echo services, monitoring stack, and automated load testing with CI integration.

Architecture Overview

┌─────────────────────────────────────────────────────────────────┐
│                        KinD Cluster                             │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐  │
│  │  Control Plane  │  │     Worker 1    │  │     Worker 2    │  │
│  │  (ingress-ready)│  │                 │  │                 │  │
│  └────────┬────────┘  └─────────────────┘  └─────────────────┘  │
│           │                                                      │
│  ┌────────▼────────┐                                            │
│  │ NGINX Ingress   │                                            │
│  │ Controller      │                                            │
│  └────────┬────────┘                                            │
│           │                                                      │
│     ┌─────┴─────┬─────────────┬─────────────┐                   │
│     ▼           ▼             ▼             ▼                   │
│ ┌───────┐  ┌───────┐   ┌──────────┐  ┌────────────┐            │
│ │  foo  │  │  bar  │   │ Grafana  │  │ Prometheus │            │
│ │ ns:foo│  │ ns:bar│   │          │  │            │            │
│ └───────┘  └───────┘   └──────────┘  └────────────┘            │
└─────────────────────────────────────────────────────────────────┘
                              │
                              ▼
                    ┌─────────────────┐
                    │   Load Tester   │
                    │    (Locust)     │
                    └─────────────────┘

Components

Component Description Directory
KinD Cluster Multi-node Kubernetes cluster (1 control-plane + 2 workers) kind/
http-echo Helm chart deploying foo and bar echo services echo/
Monitoring Prometheus, Grafana, Alertmanager stack monitoring/
Load Testing Python-based load testing with Locust loadtest/
CI/CD GitHub Actions for automated load testing on PRs .github/workflows/

Quick Start

Prerequisites

1. Create Cluster

kind create cluster --config kind/main.yaml

2. Deploy Ingress Controller

kubectl apply -f kind/ingress-nginx.yaml
kubectl wait --namespace ingress-nginx \
  --for=condition=ready pod \
  --selector=app.kubernetes.io/component=controller \
  --timeout=120s

3. Deploy http-echo Services

helm install http-echo ./echo

4. Deploy Monitoring (Optional)

./monitoring/install.sh

5. Configure Local DNS

Add to /etc/hosts:

echo "127.0.0.1 foo.localhost bar.localhost grafana.localhost prometheus.localhost alertmanager.localhost" | sudo tee -a /etc/hosts

6. Verify Deployment

curl http://foo.localhost   # Returns: foo
curl http://bar.localhost   # Returns: bar

Load Testing

Run load tests against the deployed services:

cd loadtest
pip install -r requirements.txt
python loadtest.py --urls urls.json --duration 60

See loadtest/README.md for detailed configuration options.

Access URLs

Service URL Credentials
foo http://foo.localhost -
bar http://bar.localhost -
Grafana http://grafana.localhost admin / admin
Prometheus http://prometheus.localhost -
Alertmanager http://alertmanager.localhost -

CI/CD Integration

The repository includes a GitHub Actions workflow that:

  1. Provisions a KinD cluster on PR
  2. Deploys all services
  3. Runs load tests
  4. Posts results as PR comment

See .github/workflows/load-test.yaml.

Directory Structure

.
├── README.md                 # This file
├── kind/                     # KinD cluster configuration
│   ├── README.md
│   ├── main.yaml            # Cluster config (3 nodes)
│   └── ingress-nginx.yaml   # Ingress controller manifest
├── echo/                     # http-echo Helm chart
│   ├── README.md
│   ├── Chart.yaml
│   ├── values.yaml
│   └── templates/
├── monitoring/               # Prometheus/Grafana stack
│   ├── README.md
│   ├── install.sh
│   └── values.yaml
├── loadtest/                 # Load testing suite
│   ├── README.md
│   ├── loadtest.py
│   ├── urls.json
│   ├── requirements.txt
│   └── run.sh
└── .github/
    └── workflows/
        └── load-test.yaml   # CI workflow

Documentation

Cleanup

# Delete the cluster (removes everything)
kind delete cluster --name goodnotes-cluster

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors