K6 PrivateLoadZones not accepting Cloud Environment variables

Hello everyone!

I’m new to K6 and Grafana. I’ve done some tests with it, and it is amazing for our use cases; we want to test the performance of our internal software stack.

I’ve set up a Private Load Zone as described in the Set up private load zones | Grafana Cloud documentation, and it’s working fine. I can start distributed tests on our Kubernetes cluster. To make some things dynamic inside the test script, I came across ‘Cloud environment variables’ (Cloud environment variables | Grafana Cloud documentation to make use of env vars inside the K6 test script.

The Cloud environment variables will work when I start a test using a predefined load zone in Grafana Cloud, but when I start the test on our PrivateLoadZone, they won’t be used. Is it possible to use the Cloud environment variables inside PrivateLoadZones? If so, what steps must be fulfilled to use them?

(I’ve seen TestRun instances with config maps and environment variables; this is something I don’t like to use because our team needs a graphical user interface to start the tests without using ‘kubectl’.)

Thanks!

Hi @mathijsvanwilligen,
Welcome to the forum! Environment variables are not supported by PrivateLoadZone tests yet, so sadly, there’s no way to do that now. But it is one of the features we consider adding in the future.

We are very interested in gathering feedback for PLZ like this so thank you for reaching out!

As a workaround, you could try to load values you need dynamically in the script. E.g. in setup function.

Hi @olhayevtushenko,

Thank you for your fast reply and your suggestion. I don’t think this will work for our case, the environment variables will sometimes also contains secrets what we don’t want to expose in cleartext inside the script :-).

But it saves me a lot of more investigation time now i know it isn’t possible yet. Please let me know if there is something i could provide for you to make a decision in the future of implementing this.

Thanks again for your reply, i’m going to think about a workaround/solution for our case with the needed secrets inside the script.

1 Like