Interview Prep/SRE & Reliability/Best Practices & Rapid-Fire Commands

Rapid-fire: k6 commands and flags.

BeginnerConceptBest Practices & Rapid-Fire Commands
Answer
k6 run script.js                                  # run with options from script
k6 run --vus 20 --duration 2m script.js           # override load
k6 run -e BASE_URL=http://checkout:8080 script.js # pass env, read via __ENV.BASE_URL
k6 run --out json=results.json script.js          # raw metrics
K6_PROMETHEUS_RW_SERVER_URL=http://prometheus:9090/api/v1/write \
  k6 run -o experimental-prometheus-rw script.js  # stream to Prometheus remote write
k6 inspect script.js                              # show resolved options
echo $?                                           # 99 means thresholds failed
All SRE & Reliability questions

More on Best Practices & Rapid-Fire Commands