Documentation Index
Fetch the curated documentation index at: https://grafana_com_website/llms.txt
Fetch the complete documentation index at: https://grafana_com_website/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: /docs/grafana-cloud/testing/k6/author-run/use-k6-extensions.md (append .md) or send Accept: text/markdown to /docs/grafana-cloud/testing/k6/author-run/use-k6-extensions/. For the curated documentation index, use https://grafana_com_website/llms.txt. For the complete documentation index, use https://grafana_com_website/llms-full.txt.
Use k6 extensions
k6 has a set of core functionalities that you can use via its own set of JavaScript APIs. As a user, you might want to test a service or a protocol that’s not supported by the existing k6 APIs. That’s where extensions come in.
k6 extensions are a way to extend the core functionality of k6. For k6 open source users, they can write custom extensions and then build a new k6 binary to use them locally. For Grafana Cloud k6 users, you can use a subset of these extensions when running your test scripts, without having to build a custom k6 binary.
Supported extensions in Grafana Cloud
Grafana Cloud k6 has built-in support for two categories of extensions: Official and Community.
Official extensions
These are extensions owned and maintained by Grafana Labs, with support for a wide range of versions.
Grafana guarantees regular maintenance, such as security patches and new versions that add or improve functionality.
| Extension | Description | Versions |
|---|---|---|
| xk6-dns | DNS resolution and lookups in your tests | v1.0.1, v1.0.0 |
| xk6-faker | Generate fake data in your tests | v0.4.4, v0.4.3, v0.4.2, v0.4.1, v0.4.0 |
| xk6-icmp | ICMP protocol support for k6 | v0.2.0, v0.1.0 |
| xk6-mqtt | MQTT protocol support for k6 | v0.2.0, v0.1.1 |
| xk6-redis | Extension for Redis database | v0.3.6 |
| xk6-sql | Load-test SQL Servers | v1.0.5, v1.0.4, v1.0.3, v1.0.2, v1.0.1, v1.0.0 |
| xk6-sql-driver-mysql | xk6-sql driver extension for MySQL database support | v0.2.1, v0.2.0, v0.1.0 |
| xk6-sql-driver-postgres | xk6-sql driver extension for Postgres database support | v0.1.1, v0.1.0 |
| xk6-ssh | Use SSH connections in your tests | v0.1.3, v0.1.2, v0.1.1, v0.1.0 |
| xk6-tcp | TCP protocol support for k6 | v0.2.0 |
| xk6-docs | CLI k6 docs for AI agents and users. It comes with an agent skill to help AI agents to write k6 scripts with best practices. | v0.0.8, v0.0.7, v0.0.6, v0.0.5, v0.0.1 |
| xk6-subcommand-explore | Explore k6 extensions for Automatic Resolution | v1.0.0 |
Community extensions
These are extensions developed by the community, with support for specific versions.
Grafana doesn’t guarantee support for community extensions beyond allowing the use of vetted versions.
| Extension | Description | Versions |
|---|---|---|
| xk6-disruptor | Add fault injection capabilities to k6, following the chaos engineering principles. | v0.3.17 |
| xk6-kafka | Load test Apache Kafka. Includes support for Avro messages. | v1.0.0 |
| xk6-kubernetes | A k6 extension for interacting with Kubernetes clusters while testing. | v0.10.3 |
| xk6-loki | Test Grafana Loki log ingestion endpoints | v1.0.1, v1.0.0 |
| xk6-msgpack | k6 MessagePack extension | v0.0.3 |
| xk6-client-prometheus-remote | Test Prometheus Remote Write-compatible endpoints | v0.3.2 |
| xk6-sql-driver-azuresql | xk6-sql driver extension for Microsoft Azure SQL database support | v0.1.1, v0.1.0 |
| xk6-sql-driver-clickhouse | xk6-sql driver extension for ClickHouse database support | v0.1.1, v0.1.0 |
| xk6-sql-driver-sqlserver | xk6-sql driver extension for Microsoft SQL Server database support | v0.1.1, v0.1.0 |
| xk6-sse | Server Sent Event | v0.1.11, v0.1.10 |
| xk6-tls | TLS certificates validation and inspection | v0.1.0 |
| xk6-client-tracing | This extension provides k6 with the required functionality required to load test distributed tracing backends. | v0.0.9 |
| xk6-subcommand-httpbin | Run a local httpbin server from k6 | v1.0.0 |
Use extensions in Grafana Cloud
There are different requirements for using extensions in Grafana Cloud depending on how you execute your test script.
Before you begin
- Extensions are only supported when running your test scripts using the Script editor or the CLI.
- When running your tests via the CLI, use k6 v1.2 or later, which includes native support for extension loading.
- Using extensions via the Test builder isn’t supported.
Import an extension in your test script
The first step to using a cloud extension is to import it into your test script. For example, if you
want to use the xk6-faker extension, you can add the following import statement:
import faker from 'k6/x/faker';You can then use any functionality available from the extension. For example, you can create a
random name using the faker.person class:
import faker from 'k6/x/faker';
export default function () {
console.log(faker.person.firstName());
}If you are interested in specifying the version of k6 or the extensions, refer to Override versions.
Run a test with an extension in Grafana Cloud
To run a test script that uses an extension, you have to use the Script editor or the CLI.
Run a test via the script editor
The script editor supports built-in extensions by default. You can import and use any extensions, and run your test without any additional steps.
Run a test via the CLI
Make sure you have k6 v1.2 or later installed by running the following command:
k6 versionThen, follow these steps to run your test script with extensions:
Authenticate with Grafana Cloud:
Bashk6 cloud login --token <API_TOKEN> --stack <STACK_SLUG>Run your test.
In the cloud:
Bashk6 cloud run test.jsLocally (with cloud-provisioned binary):
Bashk6 cloud run --local-execution test.js
If your script uses supported extensions, k6 automatically detects them and provisions a compatible binary, either in Grafana Cloud or locally.
Example output
INFO[0287] A new k6 binary has been provisioned with version(s): k6:v1.1.0 k6/x/faker:v0.4.4Disable extensions
You can disable this feature by setting the environment variable K6_AUTO_EXTENSION_RESOLUTION to false. If provided, the previous example
fails because k6 can’t load the extension dynamically.
For example:
K6_AUTO_EXTENSION_RESOLUTION=false k6 cloud run test.jsAnd an example output for a test failure:
ERRO[0000] GoError: unknown module: k6/x/faker hint="script exception"Was this page helpful?
Related resources from Grafana Labs


