Arguments in K6-operator


While using k6-operator to run tests inside a Kubernetes cluster, In the custom resource file I was making use of the arguments “–console-output=log1.txt --out json=RR.json”

Now where are these log1.txt and RR.json files stored and how to access them?

Hi @Akshayini,
AFAIK, most people using k6-operator are streaming outputs with extensions instead of storing them in local files, but there’re workarounds you can use here. By default, each runner uses grafana/k6 image under the hood, so these files will be located in home folder of each runner, i.e. /home/k6. You can access them inside the container while the test run executes, be it manually with kubectl exec or with the logic of custom runner image.

Alternatively, if you’re passing your script as volumeClaim, it should be possible to store your output files in the /test/ folder of that volume too. (I haven’t tried this myself though so needs double checking)

Hi Olha,
Thankyou for the response. Is there a way to send/forward the metrics collected in output file of json to loki-Grafana ?
We have loki enabled for our application and I would like to stream the metrics we get in a .json out file to loki.
At the moment i can only send log level data (console data) in loki, but I also want each request metric (Metric, Point) like we get in .json outfile to loki.

@Akshayini, yes, you can send k6 metrics similarly, with the help of outputs:

Some of these outputs are builtin in k6, while others are supported as extensions and then you’ll need a custom binary or image. Specifically for Grafana stack, you should probably look to Prometheus output.