Comments (6)
thanks @dgzlopes, I completely missed the -e
argument! And yes, it would be ideal to be able to replace the image on the operator. I'll see if I can put together a PR for this.
from k6-operator.
Yeah, using -e
won't work, just as you point out @mikaelkundert. What that does is that it allows the k6 script to use it as an environment variable. However, the statsd output is initiated outside of the actual test script. I'll raise an issue about adding support for env vars in the CRD.
from k6-operator.
Hey :)
You can pass env vars as arguments in k6. Something like this should work:
apiVersion: k6.io/v1alpha1
kind: K6
metadata:
name: k6-sample
spec:
parallelism: 4
script: k6-test
arguments: -e K6_STATSD_ADDR=something --out statsd
Another approach is to create an image with a custom k6 build that includes https://github.com/szkiba/xk6-prometheus. Then, you can use that img on the operator and scrape the metrics from the pods as usual. But idk if we have support to swap the image used by the operator (cc @simskij).
from k6-operator.
Now that #17 has been merged, we can close this :)
btw, thanks for raising the issue!
from k6-operator.
I did not get -e
argument working.
I got following errors:
time="2021-06-04T14:51:39Z" level=error msg="Couldn't flush a batch" error="write udp 127.0.0.1:36848->127.0.0.1:8125: write: connection refused" output=statsd
While having following manifest:
apiVersion: k6.io/v1alpha1
kind: K6
metadata:
name: k6-sample
spec:
parallelism: 4
script: crocodile-stress-test
arguments: -e K6_STATSD_ADDR=graphite-1622816495:8125 --out statsd
This popped up job with commands:
k6 run --quiet --execution-segment=0:1/4 --execution-segment-sequence=0,1/4,2/4,3/4,1 -e K6_STATSD_ADDR=graphite-1622816495:8125 --out statsd /test/test.js --address=0.0.0.0:6565 --paused
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: /test/test.js
output: statsd (localhost:8125)
But this doesn't work locally either. Unless I run the command as follow:
$ K6_STATSD_ADDR=graphite-1622816495:8125 k6 run --quiet --execution-segment=0:1/4 --execution-segment-sequence=0,1/4,2/4,3/4,1 -e K6_STATSD_ADDR=graphite-1622816495:8125 --out statsd ./test.js --address=0.0.0.0:6565 --paused
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
ERRO[0000] The moduleSpecifier "./test.js" couldn't be found on local disk. Make sure that you've specified the right path to the file. If you're running k6 using the Docker image make sure you have mounted the local directory (-v /local/path/:/inside/docker/path) containing your script and modules so that they're accessible by k6 from inside of the container, see https://k6.io/docs/using-k6/modules#using-local-modules-with-docker.
from k6-operator.
I noticed that error message was about missing test.js
, but here's the actual error message that indicates that latter command should work.
$ K6_STATSD_ADDR=graphite-1622816495:8125 k6 run --quiet --execution-segment=0:1/4 --execution-segment-sequence=0,1/4,2/4,3/4,1 -e K6_STATSD_ADDR=graphite-1622816495:8125 --out statsd ./test.js --address=0.0.0.0:6565 --paused
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
ERRO[0000] Couldn't make buffered client, lookup graphite-1622816495 on 127.0.0.53:53: server misbehaving output=statsd
ERRO[0000] lookup graphite-1622816495 on 127.0.0.53:53: server misbehaving
from k6-operator.
Related Issues (20)
- Add instructions for how to update the operator on releases
- Initializer fails on --execution-requirements HOT 2
- Helm Chart Install with hashicorp/helm_release provider can't find k6-operator chart HOT 2
- PrivateLoadZone resources should be immutable in CRD HOT 2
- Cannot run k6-operator "exec /manager: exec format error" HOT 7
- help .. aggregated output way HOT 2
- Investigate if buildx version can be removed
- Preserve background process from initContainers to runner HOT 5
- PrivateLoadZone: make resources more flexible
- Introduce ttlSecondsAfterFinished to TestRun HOT 1
- Refactor `TestRun` controller
- Created resources not cleaned up when TestRun is deleted HOT 1
- Helm: add configuring securityContext for the operator deployment HOT 1
- Extend support for browser tests HOT 1
- Make `dnsPolicy` and `dnsConfig` configurable HOT 2
- How to use externally-controlled executor with k6-operator? HOT 2
- Error when run test on 500 pods HOT 12
- Aggregate metrics results of TestRun HOT 3
- Extending PrivateLoadZone with image and env vars
- CI: fix Helm linting and testing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from k6-operator.