Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lreimer/continuous-k6k8s
Continuous K6 load tests on K8s.
https://github.com/lreimer/continuous-k6k8s
continuous-testing k6 k8s load-testing performance-testing pulumi
Last synced: 22 days ago
JSON representation
Continuous K6 load tests on K8s.
- Host: GitHub
- URL: https://github.com/lreimer/continuous-k6k8s
- Owner: lreimer
- License: mit
- Created: 2020-11-05T20:06:27.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-05-11T09:42:31.000Z (over 3 years ago)
- Last Synced: 2024-01-25T06:09:43.385Z (11 months ago)
- Topics: continuous-testing, k6, k8s, load-testing, performance-testing, pulumi
- Language: TypeScript
- Homepage:
- Size: 31.3 KB
- Stars: 18
- Watchers: 4
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-k6 - lreimer/continuous-k6k8s - Continuously run k6 tests in Kubernetes using cronjobs. (Examples/Templates)
- awesome-k6 - lreimer/continuous-k6k8s - Continuously run k6 tests in Kubernetes using cronjobs. (Examples/Templates)
README
# Continuous K6 Performance Tests on K8s
Continuous K6 performance and load tests on Kubernetes. We will spin up an InfluxDB to
store our load test data and Grafana to display. The K6 load test will continuously be
executed using a CronJob.## Usage with plain YAML
```bash
# first we deploy the demo application deployment
$ kubectl apply -f continuous-nginx.yaml# next you can deploy the K6 stack with InfluxDB and Grafana
$ kubectl create namespace k6
$ kubectl apply -f continuous-k6k8s.yaml -n k6# open Grafana and import on of these K6 load test dashboards
# - see https://grafana.com/dashboards/2587
# - see https://grafana.com/grafana/dashboards/4411
$ open http://localhost:3000
```## Usage with Pulumi
Just for fun, I also created Pulumi infrastructure as code to create the Continuous K6 load test stack.
```bash
# to create the Pulumi code from scratch type this
$ pulumi new kubernetes-typescript --force
$ kube2pulumi typescript -f continuous-k6k8s.yaml# and fire up the K6 stack
$ pulumi up# open Grafana and import on of these K6 load test dashboards
# - see https://grafana.com/dashboards/2587
# - see https://grafana.com/grafana/dashboards/4411
$ open http://localhost:3000
```## Create retention policy for InfluxDB
If you run the load tests continuously, you may want to create a retention policy to cleanup the test data from time to time.
```bash
# connect to the influx pod
$ kubectl exec -it pod/influxdb -- /bin/sh$ influx
$ create retention policy "k6_1d" on "k6" duration 1d replication 1 default
$ exit
```## Adhoc K6 load test with custom Docker image
```bash
# build and push the K6 load test image
$ docker build -t k6-nginx-test .
$ docker tag k6-nginx-test lreimer/k6-nginx-test
$ docker push lreimer/k6-nginx-test# run the image as a pod
# be sure to pass the --restart flag, otherwise the containers gets restarted
$ kubectl run k6-nginx-test --image lreimer/k6-nginx-test --restart=Never --attach
$ kubectl delete pod/k6-nginx-test
```## Maintainer
M.-Leander Reimer (@lreimer),
## License
This software is provided under the MIT open source license, read the `LICENSE` file for details.