Skip to main content
New to Testkube? Unleash the power of cloud native testing in Kubernetes with Testkube. Get Started >

import Tabs from "@theme/Tabs"; import TabItem from "@theme/TabItem"; import DistributedK6 from "../../workflows/distributed-k6-workflow.md"

Distributed K6 Example

import RequiresCommercialWorkflows from "../_commercial-workflows-note.mdx"

Testkube has built-in support for parallelising any testing tool - check out the Parallelization documentation for details and examples.

The below example shows how to distribute a K6 test across a configurable number of nodes

  • Takes optional run configuration parameters (config)
    • vus to declare Virtual Users to distribute
    • duration to declare Load Test time
    • workers to declare number of K6 instances to create
  • Load the K6 script from Git repository (content)
  • Run distributed K6 tests (steps[0].parallel)
    • It's using built-in distribute/evenly Test Workflow Template, that sets pod.topologySpreadConstraints to distribute pods evenly across nodes (steps[0].parallel.use)
    • It's creating as many K6 workers as has been declared in workers config (steps[0].parallel.count)
    • It copies the test case from Git repository into workers (steps[0].parallel.transfer)
    • It reserves 1/8 CPU and 128MB for each worker (steps[0].parallel.container.resources)
    • It ensures that all workers will start load tests at the same time, when all are ready (steps[0].parallel.paused)
    • It runs K6 executable against that test case (steps[0].parallel.run.shell)
      • It passes number of Virtual Users and test duration via K6 parameters
      • It uses K6 --execution-segment argument to select the fraction of tests to run
    • It retrives the generated HTML reports as artifacts

The k6 log output from one of the workers:

Distributed K6 Log Output

The uploaded HTML reports for each of the Workers is available in the Artifacts tab

Distributed K6 HTLM Report