K6 Integration Service



Keptn

K6 Integration Service

Table of Contents

Introduction

K6 is an open-source tool widely used for load testing. With Keptn’s Quality gates, we can automate the process of evaluating the results of the test and also monitor them. Keptn already supports JMeter, Locust, Litmus Chaos, and others. This project will enable users to use K6 for performance testing. Further goals include adding SLI and SLO compliance using Prometheus which K6 supports using Extensions.

Project team

Contacts

Project Details

Support for K6 will help extend Keptn community users to switch/use it as performance testing tool. K6 is considered to be a modern tool for DevOps like Keptn, so the community might be inclined towards using it.

Some of the features of K6 include:

  • It has good resource utilization and one load generator can simulate tens of thousands of virtual users
  • It is code-driven, with JavaScript as scripting language
  • K6 has native support for Prometheus

Thresholds in K6 are used for some specific pass/fail criteria. This feature is very commonly used. Based on passed/failed of Thresholds results, we’ll return the state to the Keptn control plane.

The K6 service will suscribe to the sh.keptn.event.test.triggered CloudEvent and execute the Load Testing. K6 will write the metrics to Prometheus for further step of SLO evaluation.

Work Summary

The three major milestones of this project were as follows:

  1. Run standard K6
  2. Support K6 extensions
  3. Use the metrics exported by K6 Extension for Keptn’s Quality Gate evaluations

All the three milestones were achieved.

Run Standard K6

For POC, we used the Job Executor Service for running K6 test. Job Executor Service was able to execute tests. The stdout logs were shown on Bridge and the task failed/passed based on K6 thresholds pass/fail criteria.

Support for K6 extensions

For K6 extensions support we stumbled upon the design of implementing a new Keptn service or Job Executor will do the job. Here I wrote a the boilerplate code for new Keptn service. We finally decided to move ahead with the Job Executor Service because making the Docker image and pushing it to registry did the Job. We need the install the supported tool in K8s and reachable from Keptn namespace. Kubernetes secrets and environment support in Job Executor Service helped in K6 extensions execution.

Quality Gates Evaluation

Once K6 extension support started writing the metrics to Prometheus, Keptn’s quality gates were able to fetch the SLI and do compliance check. We can add tags in K6 extension which allows us the indentify the metrics based on project, stage and service. This allows us to have best of both the worlds: K6 thresholds and Keptn Quality Gates

Tutorials

The tutorials have been kept in 3 parts in the main project repository: keptn-sandbox/k6-service

Challenges

Various challenges were faced during the project. Some are

  • Job Executor Service and Keptn setup
  • Communication from K6 extension running in JES and Prometheus
  • Docker images for K6 extension not published officially
  • Unique identifier for the K6 metrics in Prometheus based on project, stage and service

Acknowledgments

I would like to thank Adam Gardner and Pepe Cano for mentoring me through the GSOC period and helping me learn lot of cool things. I’d also like to thank Oleg Nenashev and Keptn Community for providing me this opportunity.

Project Resources

References