Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/k6/next/using-k6/secret-source/cloud.md, or by sending Accept: text/markdown to https://grafana.com/docs/k6/next/using-k6/secret-source/cloud/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.
Cloud secret source
When you run tests in Grafana Cloud using k6 cloud run, secrets management is available automatically. The cloud secret source brings that same access to local execution runs with k6 cloud run --local-execution, so you can use the same secrets without managing credentials locally.
Note
The cloud secret source only works with
k6 cloud run --local-execution. Using it withk6 runreturns an error.
Before you begin
- Authenticate with Grafana Cloud k6 using
k6 cloud login. - Configure the secrets you want to use in Grafana Cloud k6.
Use the cloud secret source
Starting in k6 v2.0.0, the cloud secret source is enabled automatically when you run k6 cloud run --local-execution. You don’t need to pass any flag, and secrets.get() works out of the box:
k6 cloud run --local-execution script.jsk6 automatically configures the credentials needed to fetch secrets from Grafana Cloud. No tokens, endpoints, or passwords are required on the command line.
k6 automatically redacts all secrets from logs.
Opt out with --no-cloud-secrets
If you don’t want the cloud secret source enabled, pass --no-cloud-secrets:
k6 cloud run --local-execution --no-cloud-secrets script.jsWith this flag, calls to secrets.get() for the cloud source will fail unless you explicitly configure another source.
Was this page helpful?
Related resources from Grafana Labs

