It works at the time of building the image from k6 base , but fails while running the Browser based test in real environment

Hi Team,

we are using K6 base image and built a Dockerfile. we can able to test for API specs tests, but browser is not working at all.
We are unable to use K6 for load testing the browser based application . Can someone help us fixing this requirement for k6:1.0.0-with-browser?

/\ Grafana /‾‾/
/\ / \ |\ __ / /
/ \/ \ | |/ / / ‾‾\
/ \ | ( | (‾) |
/ _______ \ |_|\_\ \__/

execution: local

script: vpe-default-k6-browser_gt-dev.js

output: -

scenarios: (100.00%) 1 scenario, 1 max VUs, 4m30s max duration (incl. graceful stop):

* browser_test: 1 looping VUs for 4m0s (gracefulStop: 30s)

running (0m01.0s), 1/1 VUs, 0 complete and 0 interrupted iterations

browser_test [ 0% ] 1 VUs 0m01.0s/4m0s

running (0m02.0s), 1/1 VUs, 0 complete and 0 interrupted iterations

browser_test [ 1% ] 1 VUs 0m02.0s/4m0s

running (0m03.0s), 1/1 VUs, 0 complete and 0 interrupted iterations

browser_test [ 1% ] 1 VUs 0m03.0s/4m0s

running (0m04.0s), 1/1 VUs, 0 complete and 0 interrupted iterations

browser_test [ 2% ] 1 VUs 0m04.0s/4m0s

time=“2025-08-29T21:40:17Z” level=error msg=“process with PID 21 unexpectedly ended: signal: trace/breakpoint trap (core dumped)” category=browser elapsed=“0 ms” source=browser

time=“2025-08-29T21:40:17Z” level=info msg=“[k6-reporter v2.3.0] Generating HTML summary report” source=console

time=“2025-08-29T21:40:17Z” level=info msg=“[k6-reporter v2.3.0] Generating HTML summary report” source=console

time=“2025-08-29T21:40:18Z” level=error msg=“failed to handle the end-of-test summary” error=“Could not save some summary information:\n\t- could not open ‘browser-summary.json’: open browser-summary.json: permission denied\n\t- could not open ‘browser-summary.html’: open browser-summary.html: permission denied\n\t- could not open ‘browser-report.html’: open browser-report.html: permission denied”

running (0m04.6s), 0/1 VUs, 0 complete and 1 interrupted iterations

browser_test ✗ [ 2% ] 1 VUs 0m04.4s/4m0s

time=“2025-08-29T21:40:18Z” level=error msg="error building browser on IterStart: launching browser: recvmsg: Connection reset by peer (104) at default (file:///app/k6/vpe-default-k6-browser_gt-dev.js:42:16(0))”

Thanks,

Mano

I need to run this in no-sandbox and headless mode, but why not working in container. same script works in the laptop and only not working in container build.

can you please someone help me on this issue fix running in OpenShift ?

/app/k6 $ k6 run vpe-default-k6-browser_gt-dev.js

     /\      Grafana   /‾‾/  
/\  /  \     |\  __   /  /   

/ / \ | |/ / / ‾‾\
/ \ | ( | (‾) |
/ __________ \ ||_\ ____/

 execution: local
    script: vpe-default-k6-browser_gt-dev.js
    output: -

 scenarios: (100.00%) 1 scenario, 1 max VUs, 4m30s max duration (incl. graceful stop):
          * browser_test: 1 looping VUs for 4m0s (gracefulStop: 30s)

ERRO[0005] process with PID 94 unexpectedly ended: signal: trace/breakpoint trap (core dumped) category=browser elapsed=“0 ms” source=browser

█ THRESHOLDS

browser_http_req_duration
✓ 'avg<15000' avg=0s

browser_http_req_failed
✓ 'rate<0.50' rate=0.00%

█ TOTAL RESULTS

EXECUTION
iteration_duration...................................: avg=125.3µs min=125.3µs med=125.3µs max=125.3µs p(90)=125.3µs p(95)=125.3µs
iterations...........................................: 1     0.18928/s
vus..................................................: 1     min=1      max=1
vus_max..............................................: 1     min=1      max=1

NETWORK
data_received........................................: 0 B   0 B/s
data_sent............................................: 0 B   0 B/s

BROWSER
browser_http_req_duration............................: avg=0s      min=0s      med=0s      max=0s      p(90)=0s      p(95)=0s     
browser_http_req_failed..............................: 0.00% 0 out of 0

running (0m05.3s), 0/1 VUs, 0 complete and 1 interrupted iterations
browser_test ✗ [--------------------------------------] 1 VUs 0m05.3s/4m0s
ERRO[0005] error building browser on IterStart: launching browser: recvmsg: Connection reset by peer (104) at default (file:///app/k6/vpe-default-k6-browser_gt-dev.js:42:16(0))
/app/k6 $

Hi @manoselvarajveeraiya ,

Welcome to the community forum!

How are you running the test, can you send me the CLI command that you used? It’s also worth using the latest version of k6 which is currently v1.2.3.

Here’s an example CLI command to run the fillform.js example in the examples folder:

docker run --rm -v "$PWD:/k6" ghcr.io/grafana/k6:latest-with-browser run /k6/examples/browser/fillform.js

Best,
Ankur

Hi @Ankur, Thank you for the response.

Actually , we are using Dockerfile with below base image and copying our scripts into directory then using run command.

After building the new image, we are using helm chart to deploy in OpenShift project in headless mode,.

We cannot use SYS_ADMIN capabilities as restricted for us.

no concerns for other scripts, only browser launch scripts are failing .

if you have some time, shall we connect in zoom , please let me know I will schedule a call?

\# Create /app/k6 directory

RUN mkdir -p /app/k6



\# Copy k6 files into the directory

COPY vpe-default-k6-browser_gt-dev.js /app/k6/

COPY bundle.js /app/k6/

\# Increase shared memory size for Chromium

RUN mkdir -p /dev/shm && chmod 777 /dev/shm

\# Ensure the home directory for the existing k6 user

RUN mkdir -p /home/k6 && chown -R 12345:12345 /home/k6

RUN chown -R 12345:12345 /app/k6

\# Set secure ownership and permissions for /app/k6

RUN chmod -R 755 /app/k6

\# Switch to the existing k6 user

USER 12345

WORKDIR /app/k6

\# Set Chrome environment variables for runtime execution

ENV CHROME_BIN=/usr/bin/chromium-browser

ENV CHROME_PATH=/usr/lib/chromium/

ENV K6_BROWSER_HEADLESS=true

\# Add --disable-dbus to suppress D-Bus errors

ENV K6_BROWSER_ARGS="no-sandbox"

\# Run the k6 file and wait for 5 minutes after completion, even if it fails

ENTRYPOINT \["sh", "-c", "k6 run vpe-default-k6-browser_gt-dev.js ; sleep 300000"\]

we cannot use direct public registry, we have pulled public one and using same in internal registry.

$ podman run --rm -v “$PWD:/k6” docker-gcg-prod-local.artifactrepository.citigroup.net/gcg-gcb-vpe-173456/grafana/k6:1.0.0-with-browser run /k6/examples/browser/fillform.js
WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64)

     /\      Grafana   /‾‾/  
/\  /  \     |\  __   /  /   
/  /    \\    | |/ /  /   ‾‾\\ 
/          \\   |   (  |  (‾)  |
/ \_________\_ \\  |*|\_\\  \_*\__\_/

time=“2025-09-03T16:20:34Z” level=error msg=“The moduleSpecifier "/k6/examples/browser/fillform.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://grafana.com/docs/k6/latest/using-k6/modules/#use-modules-with-docker.”

$ podman run --rm -v “$PWD:/k6” docker-gcg-prod-local.artifactrepository.citigroup.net/gcg-gcb-vpe-173456/grafana/k6:1.0.0-with-browser run vpe-default-k6-browser_gt-dev.js
WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64)

     /\      Grafana   /‾‾/  
/\  /  \     |\  __   /  /   
/  /    \\    | |/ /  /   ‾‾\\ 
/          \\   |   (  |  (‾)  |
/ \_________\_ \\  |*|\_\\  \_*\__\_/

time=“2025-09-03T16:21:23Z” level=error msg=“The moduleSpecifier "vpe-default-k6-browser_gt-dev.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://grafana.com/docs/k6/latest/using-k6/modules/#use-modules-with-docker.”
mv04774@674B06-1D9F46 k6-helm-deployment-complete-chrome-fix %

Hi @manoselvarajveeraiya,

If you have a way to contact us through official means, then please do so, check out this link for more details.

This feels to me that it is a docker issue, not k6. In the dockerfile you are copying all the files you need with:

COPY vpe-default-k6-browser_gt-dev.js /app/k6/

COPY bundle.js /app/k6/

The entry point is trying to run:

ENTRYPOINT \["sh", "-c", "k6 run vpe-default-k6-browser_gt-dev.js ; sleep 300000"\]

However the run command you are using is podman run --rm -v “$PWD:/k6” docker-gcg-prod-local.artifactrepository.citigroup.net/gcg-gcb-vpe-173456/grafana/k6:1.0.0-with-browser run /k6/examples/browser/fillform.js

Shouldn’t it be something like this if you want to run the script that is in the image:

podman build -t my-k6-browser .
podman run --rm --shm-size=1g my-k6-browser

Best,
Ankur

Hi @ankur, Thank you for the analysis and support.

what could be the reason same container image is not working in OpenShift ?

We use a helm chart to do this . your support is more appreciated , Thank you again!

helm install k6-jobs ./helm/k6-jobs \
–set baseJob.image.tag=“base-20250905-095239”
–set extendedJob.image.tag=“extended-20250905-095239”

job pod spec:

kind: Pod
apiVersion: v1
metadata:
  generateName: k6-base-job-
  annotations:
    k8s.v1.cni.cncf.io/network-status: |-
      [{
          "name": "openshift-sdn",
          "interface": "eth0",
          "ips": [
              "10.254.9.109"
          ],
          "default": true,
          "dns": {}
      }]
    kubernetes.io/limit-ranger: 'LimitRanger plugin set: ephemeral-storage request for container k6-base; ephemeral-storage limit for container k6-base'
    openshift.io/scc: restricted
  resourceVersion: '5509692672'
  name: k6-base-job-mx2f8
  
  ownerReferences:
    - apiVersion: batch/v1
      kind: Job
      name: k6-base-job
      uid: a9a26b9e-4fbd-443e-b81c-197f3ece9a3b
      controller: true
      blockOwnerDeletion: true
  finalizers:
    - batch.kubernetes.io/job-tracking
  labels:
    app.kubernetes.io/component: base-job
    app.kubernetes.io/instance: k6-jobs
    app.kubernetes.io/name: k6-jobs
    batch.kubernetes.io/controller-uid: a9a26b9e-4fbd-443e-b81c-197f3ece9a3b
    batch.kubernetes.io/job-name: k6-base-job
    controller-uid: a9a26b9e-4fbd-443e-b81c-197f3ece9a3b
    job-name: k6-base-job
spec:
  nodeSelector:
    region: primary
  restartPolicy: Never
  serviceAccountName: k6-jobs
  priority: 0
  schedulerName: default-scheduler
  enableServiceLinks: true
  terminationGracePeriodSeconds: 30
  preemptionPolicy: PreemptLowerPriority
  nodeName: app-9.namgcbgtd23d.ecs.dyn.nsroot.net
  securityContext:
    seLinuxOptions:
      level: 's0:c33,c2'
    fsGroup: 1001060000
  containers:
    - resources:
        limits:
          cpu: 500m
          ephemeral-storage: 10Gi
          memory: 1Gi
        requests:
          cpu: 250m
          ephemeral-storage: 512Mi
          memory: 512Mi
      terminationMessagePath: /dev/termination-log
      name: k6-base
      env:
        - name: HTTPS_PROXY
          value: 'natcpproxy.wlb2.nam.nsroot.net:9999'
        - name: HTTP_PROXY
          value: 'natcpproxy.wlb2.nam.nsroot.net:9999'
        - name: K6_BROWSER_ARGS
          value: no-sandbox
        - name: K6_BROWSER_HEADLESS
          value: 'true'
        - name: K6_BROWSER_TIMEOUT
          value: 60s
        - name: browserApiError
          value: '5'
        - name: browserDuration
          value: 4m
        - name: browserResponseTime
          value: '15000'
      securityContext:
        capabilities:
          drop:
            - KILL
            - MKNOD
            - SETGID
            - SETUID
            - SYS_CHROOT
        runAsUser: 1001060000
        runAsNonRoot: true
        allowPrivilegeEscalation: false
      imagePullPolicy: Always
      volumeMounts:
        - name: tmp
          mountPath: /tmp
        - name: k6-output
          mountPath: /app/k6/output
      terminationMessagePolicy: File
      image: 'docker-gcg-dev-local.artifactrepository.citigroup.net/gcg-gcb-vpe-173456/k6-test:base-20250905-095239'
      args:
        - vpe-default-k6-browser_gt-dev.js
  serviceAccount: k6-jobs
  volumes:
    - name: tmp
      emptyDir: {}
    - name: k6-output
      emptyDir: {}
  dnsPolicy: ClusterFirst
  tolerations:
    - key: node.kubernetes.io/not-ready
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
    - key: node.kubernetes.io/unreachable
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
    - key: node.kubernetes.io/memory-pressure
      operator: Exists
      effect: NoSchedule
          value: 'true'
        - name: K6_BROWSER_TIMEOUT
          value: 60s
        - name: browserApiError
          value: '5'
        - name: browserDuration
          value: 4m
        - name: browserResponseTime
          value: '15000'
      securityContext:
        capabilities:
          drop:
            - KILL
            - MKNOD
            - SETGID
            - SETUID
            - SYS_CHROOT
        runAsUser: 1001060000
        runAsNonRoot: true
        allowPrivilegeEscalation: false
      imagePullPolicy: Always
      volumeMounts:
        - name: tmp
          mountPath: /tmp
        - name: k6-output
          mountPath: /app/k6/output
      terminationMessagePolicy: File
      image: 'docker-gcg-dev-local.artifactrepository.citigroup.net/gcg-gcb-vpe-173456/k6-test:base-20250905-095239'
      args:
        - vpe-default-k6-browser_gt-dev.js
  serviceAccount: k6-jobs
  volumes:
    - name: tmp
      emptyDir: {}
    - name: k6-output
      emptyDir: {}
  dnsPolicy: ClusterFirst

Logs:

/\ Grafana /‾‾/
/\ / \ |\ __ / /
/ \/ \ | |/ / / ‾‾\
/ \ | ( | (‾) |
/ _______ \ |_|\_\ \__/
execution: local
script: vpe-default-k6-browser_gt-dev.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 4m30s max duration (incl. graceful stop):
* browser_test: 1 looping VUs for 4m0s (gracefulStop: 30s)
running (0m01.0s), 1/1 VUs, 0 complete and 0 interrupted iterations
browser_test [ 0% ] 1 VUs 0m01.0s/4m0s
running (0m02.0s), 1/1 VUs, 0 complete and 0 interrupted iterations
browser_test [ 1% ] 1 VUs 0m02.0s/4m0s
running (0m03.0s), 1/1 VUs, 0 complete and 0 interrupted iterations
browser_test [ 1% ] 1 VUs 0m03.0s/4m0s
running (0m04.0s), 1/1 VUs, 0 complete and 0 interrupted iterations
browser_test [ 2% ] 1 VUs 0m04.0s/4m0s
time=“2025-09-05T14:57:21Z” level=error msg=“process with PID 24 unexpectedly ended: signal: trace/breakpoint trap (core dumped)” category=browser elapsed=“0 ms” source=browser
time=“2025-09-05T14:57:21Z” level=info msg=“[k6-reporter v2.3.0] Generating HTML summary report” source=console
time=“2025-09-05T14:57:21Z” level=info msg=“[k6-reporter v2.3.0] Generating HTML summary report” source=console
time=“2025-09-05T14:57:22Z” level=error msg=“failed to handle the end-of-test summary” error=“Could not save some summary information:\n\t- could not open ‘browser-report.html’: open browser-report.html: permission denied\n\t- could not open ‘browser-summary.json’: open browser-summary.json: permission denied\n\t- could not open ‘browser-summary.html’: open browser-summary.html: permission denied”
running (0m04.2s), 0/1 VUs, 0 complete and 1 interrupted iterations
browser_test ✗ [ 2% ] 1 VUs 0m04.0s/4m0s
time=“2025-09-05T14:57:22Z” level=error msg=“error building browser on IterStart: launching browser: recvmsg: Connection reset by peer (104) at default (file:///app/k6/vpe-default-k6-browser_gt-dev.js:42:16(0))”

it runs successfully in my local Mac. but on container is failing with helm chart as below logs

podman run --rm --shm-size=1g docker-gcg-dev-local.artifactrepository.citigroup.net/gcg-gcb-vpe-173456/k6-test:base-20250905-095239

WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64)
     /\      Grafana   /‾‾/   /\  /  \     |\  __   /  /   
/  /    \    | |/ /  /   ‾‾\/          \   |   (  |  (‾)  |/ __________ \  ||_\  ____/
 execution: local     script: vpe-default-k6-browser_gt-dev.js     output: -   scenarios: (100.00%) 1 scenario, 1 max VUs, 1m30s max duration (incl. graceful stop):           * browser_test: 1 looping VUs for 1m0s (gracefulStop: 30s)
running (0m01.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [   2% ] 1 VUs  0m01.0s/1m0s
running (0m02.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [   3% ] 1 VUs  0m02.0s/1m0s
running (0m03.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [   5% ] 1 VUs  0m03.0s/1m0s
running (0m04.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [   7% ] 1 VUs  0m04.0s/1m0s
running (0m05.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [   8% ] 1 VUs  0m05.0s/1m0s
running (0m06.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  10% ] 1 VUs  0m06.0s/1m0s
running (0m07.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  12% ] 1 VUs  0m07.0s/1m0s
running (0m08.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  13% ] 1 VUs  0m08.0s/1m0s
running (0m09.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  15% ] 1 VUs  0m09.0s/1m0s
running (0m10.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  17% ] 1 VUs  0m10.0s/1m0s
running (0m11.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  18% ] 1 VUs  0m11.0s/1m0s
running (0m12.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  20% ] 1 VUs  0m12.0s/1m0s
running (0m13.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  22% ] 1 VUs  0m13.0s/1m0s
running (0m14.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  23% ] 1 VUs  0m14.0s/1m0s
running (0m15.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  25% ] 1 VUs  0m15.0s/1m0s
running (0m16.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  27% ] 1 VUs  0m16.0s/1m0s
running (0m17.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  28% ] 1 VUs  0m17.0s/1m0s
running (0m18.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  30% ] 1 VUs  0m18.0s/1m0s
running (0m19.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  32% ] 1 VUs  0m19.0s/1m0s
running (0m20.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  33% ] 1 VUs  0m20.0s/1m0s
running (0m21.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  35% ] 1 VUs  0m21.0s/1m0s
running (0m22.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  37% ] 1 VUs  0m22.0s/1m0s
running (0m23.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  38% ] 1 VUs  0m23.0s/1m0s^Crunning (0m24.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  40% ] 1 VUs  0m24.0s/1m0s
running (0m25.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  42% ] 1 VUs  0m25.0s/1m0s
running (0m26.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  43% ] 1 VUs  0m26.0s/1m0s
running (0m27.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  45% ] 1 VUs  0m27.0s/1m0s^Crunning (0m28.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  47% ] 1 VUs  0m28.0s/1m0s
running (0m29.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  48% ] 1 VUs  0m29.0s/1m0s
running (0m30.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  50% ] 1 VUs  0m30.0s/1m0s
running (0m31.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  52% ] 1 VUs  0m31.0s/1m0s
running (0m32.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  53% ] 1 VUs  0m32.0s/1m0s
running (0m33.0s), 1/1 VUs, 0 complete and 0 interrupted iterationsbrowser_test   [  55% ] 1 VUs  0m33.0s/1m0s

Hi @manoselvarajveeraiya,

Glad it works locally on your mac. Looking at the errors, there are two that need to be tackled next.

  • time=“2025-09-05T14:57:21Z” level=error msg=“process with PID 24 unexpectedly ended: signal: trace/breakpoint trap (core dumped)” category=browser elapsed=“0 ms” source=browser
  • time=“2025-09-05T14:57:22Z” level=error msg=“failed to handle the end-of-test summary” error=“Could not save some summary information:\n\t- could not open ‘browser-report.html’: open browser-report.html: permission denied\n\t- could not open ‘browser-summary.json’: open browser-summary.json: permission denied\n\t- could not open ‘browser-summary.html’: open browser-summary.html: permission denied”

The first error is telling you that chrome has crashed. The second error is telling you that there’s a permissions issue when it came to writing the summary html file.

Unfortunately I’m not an expert in helm or openshift so I can’t really help there.

Best,
Ankur

Yes @ankur , Actually issue is running in a container in Kubernetes only. no concerns in local run in Mac .

I have verified permission is there is 777 for the directory in /app/k6/ , which I shared the Dockerfile config too.