grafana / k6-operator

An operator for running distributed k6 tests.
Apache License 2.0
588 stars 166 forks source link

how to use K6_WEB_DASHBOARD in operator mode? #478

Open CoffeeHi opened 1 month ago

CoffeeHi commented 1 month ago

Hi guys, I deploy k6 operator in k8s cluster, but I don't know how to show K6_WEB_DASHBOARD when running TestRun CR, is it possible to show K6_WEB_DASHBOARD in distributed mode k6? I have tried in TestRun CR, but does not work.

  runner:
    env:
      - name: K6_WEB_DASHBOARD
        value: "true"
      - name: K6_WEB_DASHBOARD_PORT
        value: "5665"
      - name: K6_WEB_DASHBOARD_OPEN
        value: "true"
joanlopez commented 1 month ago

Hi @CoffeeHi,

I'm sorry, but we don't have large expertise with the k6-operator. So, let me transfer it to its specific repository, so any of its maintainers can try to help with this 🙇🏻

yorugac commented 2 weeks ago

Hi @CoffeeHi, sorry for the delay! Are you trying to find one dashboard per test with aggregated data from all runners? Or are you trying to open a dashboard to one, specific runner and configuration does not work?

CoffeeHi commented 1 week ago

Hi @yorugac , I want to open a dashboard to one, as I known from https://grafana.com/docs/k6/latest/results-output/web-dashboard/ , I can get a runtime dashboard running K6_WEB_DASHBOARD=true k6 run script.js locally, how can I do this using k6-operator in k8s cluster?

yorugac commented 1 day ago

Hi @CoffeeHi, it appears that you have already passed the dashboard option to the runners successfully:

  runner:
    env:
      - name: K6_WEB_DASHBOARD
        value: "true"

K6_WEB_DASHBOARD_OPEN makes no impact here because you're running k6 in a container: it isn't supposed to have access to your browser. But you can port-forward to any runner's dashboard with this:

kubectl port-forward pod/k6-sample-1-g4tnf 5665

And then open the dashboard in your browser just as you do with k6 standalone, that is by going to http://127.0.0.1:5665/. Each runner will have its own dashboard.

Let me know if additional information is needed!