Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

k6-browser Docker image not working in non-privileged environments #4597

Open
tao-aleixandre opened this issue Feb 28, 2025 · 0 comments
Open
Assignees

Comments

@tao-aleixandre
Copy link

tao-aleixandre commented Feb 28, 2025

Brief summary

The current official Docker image (grafana/k6:0.57.0-with-browser) requires privileged capabilities (root access or seccomp adjustments) to properly launch Chromium. (SYS_ADMIN capability or root similar)

k6 version

v0.57.0

OS

Kubernetes cluster running on Linux

Docker version and image (if applicable)

grafana/k6:0.57.0-with-browser

Steps to reproduce the problem

Steps to Reproduce the Problem

  1. Create a Kubernetes Pod in a restricted namespace:

    • The namespace has Pod Security Admission (PSA) or Gatekeeper policies applied.
    • Example restrictions:
      • privileged: false
      • allowPrivilegeEscalation: false
      • runAsNonRoot: true
  2. Deploy a Pod using the official Docker image:

    • Image: grafana/k6:0.57.0-with-browser
    • Command:
      k6 run /path/to/browser-test.js
  3. Run a basic browser test (xk6-browser) in the pod:

    • The test uses browser.newPage(), navigates to a URL, performs login steps, and takes screenshots.
  4. Check the error when Chromium launches:

    • Error message:
      process with PID xx unexpectedly ended: signal: trace/breakpoint trap (core dumped)
      error building browser on IterStart: launching browser: browser process ended unexpectedly
      
    • This happens immediately after calling:
      const page = await browser.newPage();
      

Expected behaviour

The k6-browser container should be able to run in restricted kubernetes environments:
- Run as a non-root user.
- Not require CAP_SYS_ADMIN

Actual behaviour

The k6-browser Docker image fails to run in Kubernetes environments where containers are restricted from running as root or with elevated privileges. Error shows that Chromium crashes in the middle of the execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants