K6 Operator unable to spawn starter and test pods

K6 Initializer pod is complete but starter or test pods are not spun up. On looking at the controller manager logs i seee the following error:

2024-06-13T17:53:46Z INFO controllers.TestRun Reconcile(); stage = initialization {“namespace”: “k6-perf-test”, “name”: “testrun-platform-api”, “reconcileID”: “9a99342e-4d67-48c2-b34e-c860d1fcbd75”}
2024-06-13T17:53:46Z ERROR controllers.TestRun unable to marshal: `` {“namespace”: “k6-perf-test”, “name”: “testrun-platform-api”, “reconcileID”: “9a99342e-4d67-48c2-b34e-c860d1fcbd75”, “error”: “unexpected end of JSON input”}
githubcom/grafana/k6-operator/controllers.inspectTestRun
/workspace/controllers/common.go:105
githubcom/grafana/k6-operator/controllers.RunValidations
/workspace/controllers/k6_initialize.go:55
githubcom/grafana/k6-operator/controllers.(*TestRunReconciler).reconcile
/workspace/controllers/testrun_controller.go:137
githubcom/grafana/k6-operator/controllers.(*TestRunReconciler).Reconcile
/workspace/controllers/testrun_controller.go:80
sigsk8sio/controller-runtime/pkg/internal/controller.(*Controller).Reconcile
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.16.2/pkg/internal/controller/controller.go:119
sigsk8sio/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.16.2/pkg/internal/controller/controller.go:316
sigsk8sio/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.16.2/pkg/internal/controller/controller.go:266
sigsk8sio/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.16.2/pkg/internal/controller/controller.go:227
2024-06-13T17:53:46Z ERROR Reconciler error {“controller”: “testrun”, “controllerGroup”: “k6.io”, “controllerKind”: “TestRun”, “TestRun”: {“name”:“testrun-platform-api”,“namespace”:“k6-perf-test”}, “namespace”: “k6-perf-test”, “name”: “testrun-platform-api”, “reconcileID”: “9a99342e-4d67-48c2-b34e-c860d1fcbd75”, “error”: “unexpected end of JSON input”}
sigsk8sio/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.16.2/pkg/internal/controller/controller.go:329
sigsk8sio/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.16.2/pkg/internal/controller/controller.go:266
sigsk8sio/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.16.2/pkg/internal/controller/controller.go:227

I tried running a simple test and I can see multiple pods spin up and execute console.log commands. But for a more complex test that makes api calls - the tests are not kicked off.

Appreciate some help or suggestions here!

Hi @karthikselvarajanmd,

“error”: “unexpected end of JSON input”

This error can happen if k6 initializer finished with error and produced an invalid JSON. I suggest checking the status and logs of initializer pod. Also, make sure to check that the script is valid outside of k6-operator, i.e. with local k6 run.

Btw, there is a troubleshooting guide here that might be of help too.

for a more complex test that makes api calls - the tests are not kicked off.

This is my guess, but if you’re using env vars and such, it’s a common source of frustration when trying to pass them correctly.

Hope that helps!

2 Likes

I just got back to this again and looked into the initializer pod logs. Dont see any logs there except:
The selected container has not logged any messages yet.

Thanks for the other help docs. I was able to get past some other environment variable issues.