Repository navigation
Description
Update 2026-11-26 (infra move): the Argo CD project is now in dan-petty/homelab.
- The orphan ignore entry for Secret
devops/browseris a follow-up issue there. .github/renovate/base.jsonis gone; the shared preset isrenovate/base.jsonof dan-petty/infra.- The Open WebUI values are in homelab and now pin v0.13.5, not v0.11.4. Check the Playwright client version again before you pin the server.
Follow-up: dan-petty/homelab#298.
Problem or Motivation
Agents have no browser. The devcontainer image holds no Chromium, and the project turns off the Playwright plugin (#4468). On 2026-11-13, the agents of the retric-ai website redesign could not take screenshots. They could not check their pages at 1280 and 400 px, or in light and dark.
The owner wants one shared browser in the cluster: "It would be better if I could run playwright in the k8s cluster and use it for other service integrations" (#5348). Other cluster services must be able to use it from the start. This item adds that browser server and its in-cluster path. #5348 connects the agent sessions to it.
Consumers, in order of demand:
- Agent sessions in Claude Code and Kilo. This is the demand today. They need full-page shots at 1280 and 400 px in light and dark, DOM measures, console errors and JS. Use comes in bursts during design sessions. Path: feat(devcontainer): connect agent sessions to the cluster browser #5348.
- UI and docs checks: feat(roadmap): render the project review as an HTML page #4720 (review page), feat(design): add the shared report stylesheet and layout #4754 (report.css), feat(docs): build the docs site theme from the design tokens #4745 (docs theme) and feat(docs): draw Mermaid diagrams on the docs site #4755 (Mermaid). They need DOM, computed style, JS, viewport, color scheme and console errors on a local build. On the GitHub runner they launch the preinstalled Chrome. In the devcontainer they connect to the cluster browser.
- Change validation and scraping of the hosted UIs. After a deploy, open each changed UI through its tunnel host and check that it renders. The first users are feat(design): apply the design tokens to hosted service UIs #5186 (theme shots of 9 UIs) and the start page checks (feat(k8s): deploy Homepage as the cluster start page #4598, dan-petty/homelab#338, dan-petty/homelab#339, feat(k8s): show roadmap health from the Service API #4602). The cluster browser opens the tunnel hosts directly (owner decision 2). feat(design): apply the design tokens to hosted service UIs #5186 decides the logins.
- In-cluster services. The first one is the Open WebUI web loader. It connects to a remote Playwright server with the Playwright protocol:
SafePlaywrightURLLoaderinopen_webui/retrieval/web/utils.pycallschromium.connect(playwright_ws_url). Its settings areWEB_LOADER_ENGINE=playwrightandPLAYWRIGHT_WS_URL. See "Follow-up steps" for its version gap. - Service implement Jobs. Later item 3 gives them a fixed tool set, only when a stage plan or an acceptance check needs a browser inside a Job.
Not consumers:
- Research fetches and library ingest stay on Crawl4AI
/mdor httpx. Crawl4AI keeps its built-in browser (see "Existing Tool Considered"). - Dashboard panel images stay on the Grafana renderer and
get_panel_image. - Link checks (lychee, rumdl),
devops reviewand the stage step need no browser.
Proposed Solution & Architectural Design
Run one Playwright browser server in the cluster. Keep the browser out of the devcontainer. Agent sessions, scripts and in-cluster services all connect to it.
Components
Add the product folder k8s/devops/browser/ (kustomization.yaml, deployment.yaml, service.yaml, networkpolicy.yaml, package.json, package-lock.json). Add the folder to k8s/devops/kustomization.yaml. The Application devops syncs it, so no new Application is necessary.
- Image:
mcr.microsoft.com/playwright:v1.65.0-noble@sha256:9beb546099e11f52d62e505537914870e01a67e0e6b00ae41da4775324e73dbe. Pin the tag and the digest, because MCR rebuilds tags. The image holds Node and npm, but not the Playwright package. - Server package lock:
package.jsonandpackage-lock.jsonforplaywright1.65.0 and its one dependencyplaywright-core1.65.0, sha512-locked. A kustomizeconfigMapGeneratorputs the 2 files into a ConfigMap. - Init container (same image): copy the 2 files to the emptyDir
/app. Runnpm ci --ignore-scripts --no-audit --no-fundwith the npm cache in/tmp. The fetch is about 5 MB at each pod start, over the public TCP 443 rule. - Main container:
node /app/node_modules/playwright/cli.js run-server --host 0.0.0.0 --port 3000 --path /<path> --max-clients 4 --artifacts-dir /tmp/artifacts. Mount/appwithreadOnly: true, so a client cannot replace server code after a container restart.- Start the server through
sh -c. Read the path from an environment variable. If the value is empty, exit with a message that names the Kubernetes Secret object. Then the server never serves on a known path. - Do not put the path in the args as
$(VAR). Kubernetes keeps an undefined$(VAR)as literal text. - Do not set
DEBUG=pw:server. Its lines log the connection path.
- Start the server through
- The path value:
- Add a keyring row
browser_ws_pathinsrc/devops_cli/k8s/cluster_secrets.pyfor the Kubernetes Secret objectdevops/browser, keyws-path. When the keyring has no value, push-secrets adopts the live value, or else generates 64 hex. - A person runs
devops k8s push-secrets --only devops/browserbefore the merge. Agents do not create or change the object. - The Deployment reads the key with an optional
secretKeyRef. Thus a missing object gives the clear exit message above, notCreateContainerConfigError. - Add the object to the
orphanedResourcesignore list ink8s/argocd/apps/projects.yamlof dan-petty/homelab (follow-up issue), and add a row to the "Cluster Secrets" table ink8s/README.md.
- Add a keyring row
- Service
browser: ClusterIP, TCP 3000, selectsapp.kubernetes.io/name=browser. In-cluster endpoint:ws://browser.devops.svc.cluster.local:3000/<path>?browser=chromium. - Deployment
browser: 1 replica, strategyRecreate. No Ingress and no tunnel host. - Resources: requests 500m CPU and 1Gi memory. Limits 2 CPU, 4Gi memory and 2Gi ephemeral storage. Set the final limits from proof (c).
- Placement: a required nodeAffinity keeps the pod off control-plane nodes, as for crawl4ai (1 GB image). Do not write a node name.
shareProcessNamespace: true. The pause container is PID 1 and reaps orphan Chromium processes.- Readiness: an exec probe,
node -e "fetch('http://127.0.0.1:3000/')", that expects 200Running. If run-server answers/differently when--pathis set, the probe reads the path from the environment variable. The path must not be in the probe text of the pod spec. - No liveness probe. A liveness restart or an OOM kill ends every open session.
- Pod hardening (namespace
devopsenforces Pod Security restricted):runAsNonRootwith the numeric uid and gid ofpwuser. Read them from/etc/passwdof the pinned image, because the image config sets no user.- seccomp
RuntimeDefault,allowPrivilegeEscalation: false, drop ALL,readOnlyRootFilesystem: true. automountServiceAccountToken: false,enableServiceLinks: false.- emptyDirs with
sizeLimitfor/tmpand/app. SetHOME=/tmp/home. Do not mount/dev/shm: Playwright passes--disable-dev-shm-usage, so Chromium shared memory goes to/tmp.
- NetworkPolicy
browser-perimeter(selectsapp.kubernetes.io/name=browser):- Ingress: one rule only. It admits TCP 3000 from pods with the label
devops.io/browser-client: "true"in the namespacesdevopsandllm. Put the namespaceSelector and the podSelector in onefromentry, so both must match. Nothing else gets in. A port-forward enters the pod network namespace and needs no rule. - Egress: CoreDNS in kube-system on port 53, and TCP 80 and 443 to 0.0.0.0/0 minus 10/8, 172.16/12, 192.168/16, 100.64/10, 169.254/16, 192.0.0/24 and 198.18/15. Copy the crawl4ai list.
- Add
browserto the NotIn list ofdevops-default-perimeterink8s/devops/networkpolicy.yaml. NetworkPolicies add up. Without that entry, the pod reaches the gateway, Valkey and OTel, and every pod indevopsreaches the server. - The
llm-default-perimeteregress already allows 0.0.0.0/0 except the metadata address. Thus a labelled pod inllmneeds no new egress rule.
- Ingress: one rule only. It admits TCP 3000 from pods with the label
- Renovate group
playwrightin.github/renovate.json: the kubernetes manager for the image tag and digest, and the npm manager for the server lock. feat(devcontainer): connect agent sessions to the cluster browser #5348 adds the pep621 manager for the client pin. Put the rule after the base groupscontainer imagesandpython dependencies, or it does not apply. SetseparateMinorPatch: true. OSV security alerts come at once. - Image scan: a separate report-only job for the browser image in
.github/workflows/third-party-image-scan.yml. Give it a path filter onk8s/devops/browser/**and its own timeout, so that it does not push the crawl4ai job past 5 minutes. It reports only (exit-code 0) and is not required. Findings get an issue by the normal route. Renovate OSV alerts cover the lockfiles. - Alerts in
k8s/devops/monitoring/prometheus-rules-values.yaml:BrowserUnavailable:kube_deployment_status_replicas_available{namespace="devops",deployment="browser"} < 1for 15m.BrowserOOMKilled: a restart with the last terminated reason OOMKilled.- run-server has no
/metricsendpoint, and the debug log is off. Measure the load from the cAdvisor CPU and memory series of the pod. Later item 3 adds a client counter for Jobs.
- Docs:
docs/CLUSTER.mdandk8s/README.mdname the port-forward command, the rule to run it again after a pod restart, where a client gets the path, the push-secrets command for the owner, the client label, and the fix for HTTP 428.
Access paths
All paths use the Playwright protocol (WebSocket) to run-server, and all need the path. The cluster has no HTTP MCP endpoint, no Ingress and no tunnel host for the browser.
- Agent sessions in Claude Code and Kilo (feat(devcontainer): connect agent sessions to the cluster browser #5348):
- Transport:
kubectl port-forward -n devops deploy/browser 13000:3000. It binds 127.0.0.1:13000 on the workstation. Off the home network, rundevops k8s tunnel startfirst.devops k8s port-forwardknows only the stacks infra and llm, so the docs name plain kubectl. - Endpoint:
ws://127.0.0.1:13000/<path>?browser=chromium. The query is necessary: the bundled MCP sends no browser name, and run-server then fails with "launch mode for null". - The path comes from the keyring value
browser_ws_path. It is never in a committed file. - exposeNetwork:
<loopback>:8821,<loopback>:8822,<loopback>:8823only. Connect timeout: 30 s. - The forward stops when the pod restarts. Then the user runs the command again. There is no fallback URL and no wrapper script.
- Transport:
- Scripts and tests on the workstation:
- They use the same port-forward, endpoint and path, with the Python connect API from
uv.lock. - A script for public pages or tunnel hosts sets no exposeNetwork. The pod opens those pages.
- A script for a local preview names only its port.
- They use the same port-forward, endpoint and path, with the Python connect API from
- In-cluster services:
- A pod with the label
devops.io/browser-client: "true"in namespacedevopsorllmconnects tows://browser.devops.svc.cluster.local:3000/<path>?browser=chromium. - The client reads the path from a Kubernetes Secret object in its own namespace. One keyring value can feed an object in each client namespace, as
mcp_tokendoes. The follow-up of each client adds its object. - The client version must match the server major.minor (see "Version rule").
- A pod with the label
The GitHub runner uses no cluster. CI visual checks launch the preinstalled Chrome (channel="chrome").
Why no HTTP MCP and no tunnel host for the browser:
- An in-cluster MCP server exposes only its own pod loopback. It cannot show devcontainer previews.
@playwright/mcpsays that it "is not a security boundary".- A WebSocket through Cloudflare Access needs Service Auth credentials, and the CLI has no code for them. The edge limits (about 125 s) are not tested.
- A tunnel host is an environment file, so it waits for feat(argocd): read the environment from the homelab repo #5134.
Security
- run-server has no authentication. With
--host 0.0.0.0, its Host and Origin check is off. Two gates replace it: the NetworkPolicy ingress rule (the client label indevopsorllm) and the private path. - A pod without the client label gets no connection. A labelled pod with a wrong path is refused.
- The path also guards traffic that a NetworkPolicy does not always cover, such as traffic from the host network of a node, and port-forward users.
- A page in the browser runs in the pod and can open
ws://127.0.0.1:3000/. There, the path is the only gate. Thus keep the path out of logs, committed files, issues and pull requests, and keep the debug log off. - The pod holds no API credential and no ServiceAccount credential. It holds only its own path value. It has no service links.
- Egress allows DNS and public TCP 80 and 443 only. It allows no private, shared, link-local or metadata range, and no cluster Service.
- Accepted risk (owner decision 2): Cloudflare Access bypasses the homelab public IP, and pod egress leaves through that IP. Thus any pod with public egress, Crawl4AI included, can open the tunnel hosts without an Access login, and Grafana allows anonymous Viewer. The owner accepts this for the homelab development environment.
- An agent that drives the browser reads top-level pages, and CORS does not apply to that. The agent MCP config of feat(devcontainer): connect agent sessions to the cluster browser #5348 limits allowed origins. This is a guard, not a boundary.
- Without
--unsafe, run-server drops client args,executablePathandchromiumSandbox. - Each connection gets a new browser, which closes at disconnect.
- A client can write a download to
/tmpthroughsaveAs. Those files stay until the pod is deleted. - The exposeNetwork rule of the agent client names only the preview ports. Never use bare
<loopback>or*. Thus a page cannot reach other devcontainer forwards: Argo CD 8080, Grafana 8030, Prometheus 9090, Ollama 11434, Qdrant 6333, Valkey 6379, OTel 4318 and the browser forward 13000. - The client checks the exposeNetwork rule again and answers
ERULESET, so a compromised server cannot widen it. A host that the rule does not match goes directly from the pod, under the pod policy. - Chromium runs with
--no-sandbox(owner decision 1, accepted). The pod controls contain it: non-root, drop ALL, read-only root, RuntimeDefault seccomp, no API credential, public-only egress, limits,--max-clients 4and 1 replica. This is the same as Crawl4AI. A renderer exploit gets the pod user, the path, the public web and the exposeNetwork rules of the open connections. - No logged-in sessions in this item or in feat(devcontainer): connect agent sessions to the cluster browser #5348. feat(design): apply the design tokens to hosted service UIs #5186 decides each login.
Version rule
- The server refuses a client on another major.minor with HTTP 428, and the connection stops. This fails closed.
- The server lock version must equal the image version exactly, because the server looks for the browser revision in
/ms-playwright. - One Renovate group pull request moves the image, the server lock and the client pin of feat(devcontainer): connect agent sessions to the cluster browser #5348. Tests keep them together. A partial group pull request fails the tests until Renovate adds the missing pins.
- After the merge, Argo CD moves the server in minutes. Worktrees get the new client at once. The main checkout gets it at the next
git pulland MCP restart. - The docs map the 428 message ("Playwright version mismatch") to "git pull, then restart the browser MCP server". The gap comes once for each minor, about every 4 to 6 weeks.
- A third-party client has its own pin, and Renovate does not move it with this group. Check its pin before its follow-up.
Target Subsystem
Kubernetes & Minikube Automation
Existing Tool Considered
Open tools cover each part:
- Server: Playwright
run-server1.65.0 (Apache-2.0), the remote server in the Playwright Docker docs, in the official MCR image, with the package from an npm lockfile. Open WebUI runs the same server for its web loader (itsdocker-compose.playwright.yaml). - Agent client: the MCP server that Playwright bundles, from the PyPI wheel in
uv.lock(feat(devcontainer): connect agent sessions to the cluster browser #5348). - Scripts, tests and in-cluster services: the Playwright connect API. CI uses the runner Chrome.
- Transport:
kubectl port-forwardfor the workstation, and Service DNS in the cluster. - Gates: NetworkPolicy, the run-server
--path, Pod Security, and the keyring and push-secrets route for the path value. - Pins: Renovate.
Nothing is home-grown. The build is configuration and checks: manifests, 1 npm lockfile, 1 keyring row, a Renovate rule, invariant tests, 2 alerts and docs. It adds no image and no CLI command.
Crawl4AI cannot use this server. crawl4ai 0.9.5 connects to an external browser only over CDP: crawl4ai/browser_manager.py calls chromium.connect_over_cdp(cdp_url). run-server serves the Playwright protocol, not CDP. Thus Crawl4AI keeps its built-in browser.
Rejected options:
- browserless: SSPL.
- Lightpanda: AGPL.
- Selenoid: archived.
- Selenium Grid: its Playwright support is experimental, and the image is 1 GB.
- Steel: beta.
- chromedp headless-shell and chrome-devtools-mcp: CDP only and no exposeNetwork. chrome-devtools-mcp also sends Google telemetry by default.
- The
@playwright/mcpimage or package 0.0.85: they bring the 1.66 alpha, so the 1.65 server answers HTTP 428. mcr.microsoft.com/playwright/python: its build deletes the temporary venv that holds the wheel. It has no Playwright package and no Node.- A derived image: a fourth first-party image with CI, scan and release cost, for 2 npm packages.
- A Node client lock in the devcontainer image: it moves only when a person rebuilds the image, and it waits for build(devcontainer): add ping, traceroute, mtr, nc and tcpdump #5343.
- Chromium in the devcontainer image (feat(devcontainer): connect agent sessions to the cluster browser #5348 as first written): several hundred MB in each image, sandbox work under rootless Podman, a copy on each workstation, and no path for in-cluster integrations.
Build estimate (agent tokens and elapsed time):
- This item: about 3M to 4M tokens (manifests with the Service and the path, 1 keyring row, about 10 tests, docs, proofs, 2 to 3 CI rounds). About 1.5 days with review.
- feat(devcontainer): connect agent sessions to the cluster browser #5348: about 0.7M to 1.2M tokens. Half a day.
- Total for both: about 4M to 5M tokens. With later item 3: about 5M to 6.5M tokens, about 1 to 3 USD at the DeepSeek job rate.
Keep cost:
- One Renovate group pull request for each Playwright minor (every 4 to 6 weeks) and for each patch. Each costs about 50k to 200k tokens when the lockstep test or a client fails.
- At each minor, a short window of HTTP 428 for sessions on a stale checkout. The fix is
git pulland an MCP restart. - About 1 GB of image pull on a GPU worker at each bump. About 5 MB from npm at each pod start.
- A permanent request of 500m CPU and 1 GiB on one GPU worker (about 2% of its memory). The limit is 4 GiB.
- Trivy can report unfixed CVEs in the Firefox, WebKit or ffmpeg layers. File an issue by the normal route. Do not build an image to remove them unless the findings repeat.
- One OOM kill ends every open session (up to 4).
Acceptance Criteria
Proofs. Record each result in the pull request. Never write the path or a tunnel host name in the issue or the pull request.
- (a) Through
kubectl port-forward -n devops deploy/browser 13000:3000and the path, a one-shot Python client (uv run --with playwright==1.65.1, in scratch) takes a shot of a public page. It also takes a shot of a127.0.0.1:8821preview with exposeNetwork<loopback>:8821and?browser=chromium. - (b)
playwright mcpwith the planned config of feat(devcontainer): connect agent sessions to the cluster browser #5348 (the endpoint with the path) takes the same preview shot. - (c) Peak memory with 4 parallel clients is measured. The limits come from that measure. The docs record that one OOM kill ends all sessions.
- (d) A fifth client with timeout 30000 fails in about 30 s.
- (e) A pod without the client label gets no connection. A pod with the label and a wrong path is refused. A pod with the label and the path gets a browser. Run the labelled checks from namespace
devopsand from namespacellm. - (f) Feature check: a pod with the client label opens one tunnel host through the browser and gets the app page, not the Access login page. Record only a count or a status code.
- (g) The server log holds no path and no page URL during navigation.
- (h) The image label
org.opencontainers.image.versionequals the server lock version. - (i) A throwaway pod with the browser label cannot reach the metadata address 169.254.169.254 or a private ClusterIP.
Invariant tests in tests/invariants/:
- The Service
browserexists: ClusterIP, TCP 3000, and it selects the browser pod. - No Ingress object and no tunnel host route in the repository names the Service
browser. - The ingress of
browser-perimeterhas one rule: TCP 3000 from pods withdevops.io/browser-client: "true"in the namespacesdevopsandllm, in onefromentry. - The run-server command holds
--host 0.0.0.0and--path, and does not hold--unsafe. It refuses an empty path. No container setsDEBUG. - The path comes from an optional
secretKeyReftodevops/browser, and theorphanedResourceslist holds that object. - The egress except list of
browser-perimeterholds every private range. -
browseris in the NotIn list ofdevops-default-perimeter. - The exact server lock version equals the image tag version.
Also:
- The keyring row
browser_ws_pathexists, and the "Cluster Secrets" table ofk8s/README.mdnames it. - The alerts
BrowserUnavailableandBrowserOOMKilledexist. - The report-only image scan job runs only on
k8s/devops/browser/**changes and finishes in its own timeout. -
docs/CLUSTER.mdandk8s/README.mdname the port-forward command, the path source, the client label, the push-secrets command and the 428 fix. - Owner step: a person ran
devops k8s push-secrets --only devops/browserbefore the merge.
Dependencies
None. This item adds no Ingress, tunnel host, namespace or Application, and it changes no environment file. Thus it does not wait for the homelab switch (#5134). It does not change the devcontainer Dockerfile, so it does not wait for #5343.
Related: #5348 adds the agent client side and depends on this item.
Owner decisions
Both decisions have answers (2026-11-13). The only owner step before the merge is the push-secrets run for the path value.
- Chromium
--no-sandbox: answered, accepted (option a). Chromium runs with--no-sandboxin the browser pod under Pod Security restricted, as for Crawl4AI. The pod controls contain it. Options b and c are in "Later". - Cloudflare Access home-IP bypass: answered, keep it. The cluster browser may open the tunnel hosts. This has value for scraping and change validation. Proof (f) is a feature check, and the accepted risk is in "Security".
Follow-up steps (not filed)
Open WebUI web loader:
- Set the label
devops.io/browser-client: "true"on the Open WebUI pod. - Set
WEB_LOADER_ENGINE=playwrightandPLAYWRIGHT_WS_URL. The URL holds the path, so it comes from a Kubernetes Secret object inllmthat the same keyring value feeds. - Version gap: Open WebUI v0.11.4 (the deployed tag in
k8s/llm/values-open-webui.yaml) and its main branch (2026-11-13) pinplaywright==1.60.0. Its own compose file runs a 1.60.0 server to match. A 1.65 server answers HTTP 428 to that client. Thus the follow-up must first pick one option:- Run a second server instance at the Open WebUI pin, as Open WebUI's compose file does. Cost: one more pod request and a pin that moves with the Open WebUI chart, not with the Renovate group.
- Wait for an Open WebUI release whose pin has the same major.minor as this server.
- Do not move this server to 1.60. The bundled
playwright mcpof feat(devcontainer): connect agent sessions to the cluster browser #5348 exists only from 1.62.
Later
Do not file these items now. File each one only when its trigger occurs.
feat(k8s): let Service Jobs use the cluster browser. Trigger: a stage plan or an acceptance check needs a browser inside a Job. CI on the runner covers the UI checks today. Scope: the client label on Job pods, the path in the Job environment, the settingbrowser.ws_endpointwith no default, the playwright pin in an extra of the runner image, a pydantic-ai MCP toolset with fixed tools for the Coder, and a client counter.- A CDP endpoint for CDP-only clients (Crawl4AI, browser-use, pydantic-ai-harness PlaywrightBrowser). File it as a separate item only if the owner asks. CDP has no authentication, so it needs the same label rule.
- If the Access home-IP bypass changes in the future: the browser callers get a Cloudflare Access service token. They send its Service Auth headers for each browser context. A person creates the Kubernetes Secret object that holds it.
- A Chromium sandbox (a Localhost seccomp profile with
hostUsers: false, or gVisor as a RuntimeClass): only if the browser later gets egress to internal Services.
Not verified yet
The proofs close most open points. These points need a check during the build:
- The exact form of the run-server
--pathvalue (leading slash), and the answer ofGET /when--pathis set. - The latency and the stability of a long WebSocket session through the port-forward.
- The numeric uid and gid of
pwuserin the pinned image. npm ciofplaywright1.65.0 works with a read-only root, the cache in/tmpandHOME=/tmp/home. The init time.- run-server from the npm package finds
chromium_headless_shell-1254in/ms-playwrightof thev1.65.0-nobleimage. - Renovate puts the docker tag and digest and the npm lock into one
playwrightgroup pull request, and its docker versioning handles the tag formv1.65.0-noble. - A Trivy scan of the 1 GB image finishes in its own job well under 5 minutes.
Alternatives check of 2026-11-28: in-use.
The item already names this tool.
Tool: microsoft/playwright (https://github.com/microsoft/playwright), Apache-2.0, last activity 2026-11-27, maintained.
Reason: Fact reads confirm the official Playwright run-server is maintained and Apache-2.0, and the issue already selects it; it serves remote Chromium over WebSocket to agents, scripts and in-cluster clients, so only configuration is added.
Covers:
- Remote Chromium server over WebSocket for many clients
- Official pinned Docker image with matching browser revisions
- Python and Node connect API for scripts and services
- Client cap and artifact directory flags on the server
Lacks:
- No authentication on run-server; needs NetworkPolicy and private path
- No metrics endpoint for load or client counts
- Playwright protocol only, no CDP endpoint for Crawl4AI
- Client must match server major.minor or get HTTP 428
Proposed design
Problem statement
Add one pinned Playwright browser server in namespace devops and its in-cluster path, so agent sessions, scripts and in-cluster services reach a shared browser. The devcontainer keeps no Chromium, and the project turns off the Playwright plugin (#4468). The cluster browser serves full-page screenshots, DOM measures, console errors and JS at chosen viewports and color schemes. #5348 connects the agent sessions and depends on this item. The change adds no Ingress, no tunnel host, no namespace and no Application. One person runs devops k8s push-secrets --only devops/browser before the merge; this is the only gate.
Acceptance criteria
Requirement: The browser folder joins the devops stack
The change SHALL add the folder k8s/devops/browser/ with kustomization.yaml, deployment.yaml, service.yaml, networkpolicy.yaml, package.json and package-lock.json, and SHALL list that folder in k8s/devops/kustomization.yaml.
Scenario: The k8s check renders the browser folder
- WHEN A person runs
uv run devops ci --check --only k8s. - THEN The check passes and its render holds the
browserDeployment, Service and NetworkPolicy in namespacedevops.
Requirement: The server image is pinned by tag and digest
The Deployment browser SHALL pin the server image mcr.microsoft.com/playwright:v1.65.0-noble@sha256:9beb546099e11f52d62e505537914870e01a67e0e6b00ae41da4775324e73dbe by tag and by digest.
Scenario: The k8s check shows the pinned image
- WHEN A person runs
uv run devops ci --check --only k8s. - THEN The check passes and the rendered pod spec holds the tag
v1.65.0-nobleand the digestsha256:9beb546099e11f52d62e505537914870e01a67e0e6b00ae41da4775324e73dbe.
Requirement: The server lock sits in a ConfigMap
The change SHALL lock playwright 1.65.0 with playwright-core 1.65.0 in k8s/devops/browser/package-lock.json, and a kustomize configMapGenerator SHALL put package.json and package-lock.json into a ConfigMap.
Scenario: The k8s check shows the 2 lock files in a ConfigMap
- WHEN A person runs
uv run devops ci --check --only k8s. - THEN The check passes and the rendered ConfigMap holds the keys
package.jsonandpackage-lock.json.
Requirement: The init container installs the server package
The init container SHALL copy the 2 lock files into the emptyDir /app and MUST run npm ci --ignore-scripts --no-audit --no-fund with the npm cache in /tmp.
Scenario: The k8s check shows the init container command
- WHEN A person runs
uv run devops ci --check --only k8s. - THEN The check passes and the rendered init container command holds
npm ci --ignore-scripts --no-audit --no-fundand the cache path/tmp.
Requirement: The server command holds the host, the path and the client cap
The main container SHALL start node /app/node_modules/playwright/cli.js run-server --host 0.0.0.0 --port 3000 --path with --max-clients 4, SHALL mount /app read-only, and MUST set neither --unsafe nor DEBUG.
Scenario: The k8s check shows the run-server command
- WHEN A person runs
uv run devops ci --check --only k8s. - THEN The check passes, the rendered command holds
--host 0.0.0.0,--pathand--max-clients 4, the/appmount isreadOnly: true, and no container setsDEBUGor--unsafe.
Requirement: The path comes from the Secret
The Deployment browser SHALL read the path from an optional secretKeyRef to Secret devops/browser, key ws-path.
Scenario: The k8s check shows the optional secret reference
- WHEN A person runs
uv run devops ci --check --only k8s. - THEN The check passes and the rendered pod spec holds the optional
secretKeyRefto Secretdevops/browser, keyws-path.
Requirement: The start script refuses an empty path
The start script MUST exit with a message that names Secret devops/browser when the path value is empty.
Scenario: The k8s check shows the empty-path guard
- WHEN A person runs
uv run devops ci --check --only k8s. - THEN The check passes and the rendered command holds the guard that exits with a message that names Secret
devops/browserwhen the path value is empty.
Requirement: The keyring row holds the path value
The change SHALL add the keyring row browser_ws_path for Secret devops/browser, key ws-path, to CLUSTER_SECRETS in src/devops_cli/k8s/cluster_secrets.py.
Scenario: The cluster secret table holds the browser row
- WHEN A person runs
uv run pytest tests/k8s/test_cluster_secret_push.py. - THEN The test passes and the table holds the row
devops/browserwith the keyring sourcebrowser_ws_pathand the keyws-path.
Requirement: The Service is ClusterIP and no Ingress names it
The Service browser SHALL be ClusterIP on TCP port 3000 and SHALL select the pods with the label app.kubernetes.io/name=browser, and the change MUST add no Ingress object and no tunnel host route for it.
Scenario: The k8s check shows the Service and no Ingress
- WHEN A person runs
uv run devops ci --check --only k8s. - THEN The check passes, the rendered Service holds the ClusterIP type, the TCP 3000 port and the selector, and the render holds no Ingress object for Service
browser.
Requirement: The pod meets Pod Security restricted
The browser pod MUST meet Pod Security restricted: runAsNonRoot with the numeric uid and gid of pwuser, seccomp RuntimeDefault, allowPrivilegeEscalation: false, drop ALL, readOnlyRootFilesystem: true, automountServiceAccountToken: false and enableServiceLinks: false.
Scenario: The k8s check shows the hardened pod
- WHEN A person runs
uv run devops ci --check --only k8s. - THEN The check passes and the rendered pod spec holds each of those settings with the numeric uid and gid of
pwuser.
Requirement: The pod runs one replica with its placement and its volumes
The Deployment SHALL run 1 replica with the strategy Recreate, SHALL set a required nodeAffinity that keeps the pod off control-plane nodes, SHALL set shareProcessNamespace: true, and SHALL give /tmp and /app emptyDirs with sizeLimit and HOME=/tmp/home.
Scenario: The k8s check shows the replica, the placement and the volumes
- WHEN A person runs
uv run devops ci --check --only k8s. - THEN The check passes and the rendered Deployment holds 1 replica, the
Recreatestrategy, the required nodeAffinity,shareProcessNamespace: true, the 2 sized emptyDirs andHOME=/tmp/home.
Requirement: The readiness probe reads the server and no liveness probe restarts it
The Deployment SHALL set the exec readiness probe node -e "fetch('http://127.0.0.1:3000/')" that expects 200 Running, and MUST set no liveness probe.
Scenario: The k8s check shows the readiness probe and no liveness probe
- WHEN A person runs
uv run devops ci --check --only k8s. - THEN The check passes, the rendered pod spec holds that exec readiness probe, holds no liveness probe, and holds no path in the probe text.
Requirement: The NetworkPolicy admits only labelled clients
NetworkPolicy browser-perimeter SHALL admit TCP 3000 in one ingress rule from pods with the label devops.io/browser-client: "true" in the namespaces devops and llm, with the namespaceSelector and the podSelector in one from entry.
Scenario: The k8s check shows the one ingress rule
- WHEN A person runs
uv run devops ci --check --only k8s. - THEN The check passes and the rendered policy holds one ingress rule with that one
fromentry.
Requirement: The egress reaches DNS and the public web only
NetworkPolicy browser-perimeter SHALL allow egress to CoreDNS in kube-system on port 53 and TCP 80 and 443 to public addresses, with 10/8, 172.16/12, 192.168/16, 100.64/10, 169.254/16, 192.0.0/24 and 198.18/15 in the except list.
Scenario: The k8s check shows the egress rules
- WHEN A person runs
uv run devops ci --check --only k8s. - THEN The check passes and the rendered policy holds the DNS rule and the except list with those 7 ranges.
Requirement: The devops default perimeter excludes the browser
devops-default-perimeter SHALL list browser in its NotIn list in k8s/devops/networkpolicy.yaml.
Scenario: The k8s check shows the browser in the NotIn list
- WHEN A person runs
uv run devops ci --check --only k8s. - THEN The check passes and the rendered
devops-default-perimeterholdsbrowserin its NotIn list.
Requirement: One Renovate group moves the image and the server lock
.github/renovate.json SHALL hold the group playwright with the kubernetes manager for the image tag and digest and the npm manager for the server lock, after the base groups container images and python dependencies, with separateMinorPatch: true.
Scenario: The Renovate config validator reads the group
- WHEN A person runs
npx --yes --package [email protected] renovate-config-validator --strict --no-global .github/renovate.json. - THEN The command exits 0 and prints
Config validated successfully against 2 file(s), so the edited config, with theplaywrightgroup after those 2 base groups andseparateMinorPatch: true, is accepted.
Requirement: The browser image scan only reports
.github/workflows/third-party-image-scan.yml SHALL hold a separate report-only job for the browser image with a path filter on k8s/devops/browser/** and its own timeout, and that job MUST exit 0.
Scenario: The workflow check reads the browser scan job
- WHEN A person runs
uv run devops ci --check --only actionlint,zizmor. - THEN The check passes and the workflow holds the browser job with the path filter, its own timeout and the report-only exit code.
Requirement: The browser alerts exist
k8s/devops/monitoring/prometheus-rules-values.yaml SHALL hold the alerts BrowserUnavailable and BrowserOOMKilled.
Scenario: The k8s check shows the 2 alerts
- WHEN A person runs
uv run devops ci --check --only k8s. - THEN The check passes and the rendered rules hold
BrowserUnavailableandBrowserOOMKilled.
Requirement: The server lock version equals the image version
The server lock version MUST equal the image version exactly, because the server looks for the browser revision in /ms-playwright.
Scenario: The image label matches the lock version
- WHEN A person runs the pinned image and reads its label
org.opencontainers.image.version. - THEN The label equals the version in
k8s/devops/browser/package-lock.json.
Requirement: The docs name the commands and the gates
docs/CLUSTER.md and k8s/README.md SHALL name the port-forward command, the rule to run it again after a pod restart, the path source, the push-secrets command, the client label and the fix for HTTP 428.
Scenario: The docs test reads the 2 documents
- WHEN A person runs
uv run pytest tests/k8s/test_browser_docs.py. - THEN The test passes and each document names the port-forward command, the rule to run it again after a pod restart, the path source, the push-secrets command, the client label and the 428 fix.
Existing Tool Considered
The alternatives check of 2026-11-17 in the issue body records the verdict in-use for microsoft/playwright (https://github.com/microsoft/playwright), Apache-2.0, maintained, because the item already names that tool. The comment of the check lists what the tool covers and lacks; this answer does not restate that list. The change keeps that one tool: it runs the official run-server from the pinned MCR image and adds only repository configuration around it. The proposal covers the lacks with NetworkPolicy ingress, the private path, Pod Security, cAdvisor alerts, the Renovate group, the image scan job and the docs. It builds no browser code, so no written cost of home-grown code applies. The body estimates that configuration at about 3M to 4M tokens and about 1.5 days with review.
Key questions
- Does Chromium run with
--no-sandboxin the browser pod?: Yes. The owner answered decision 1 on 2026-11-13: Chromium runs with--no-sandboxin the browser pod under Pod Security restricted, as the Crawl4AI pod does, and the owner accepted that risk. The pod controls contain it: non-root, drop ALL, read-only root, RuntimeDefault seccomp, no API credential, public-only egress, limits,--max-clients 4and 1 replica. The sandbox options stay in the Later list. (best practice) [sources: k8s/devops/crawl4ai/networkpolicy.yaml:2, openspec/changes/archive/2026-11-07-3884-crawl4ai-manifests/design.md:5]- Chosen: Run Chromium with
--no-sandboxunder the pod controls. The owner answered option a and accepted the risk on 2026-11-13; the project already runs Crawl4AI's Chromium the same way under its own perimeter. - Rejected: A Chromium sandbox through a Localhost seccomp profile with
hostUsers: false. Its trigger has not occurred: this item's egress reaches no internal Service. - Rejected: A Chromium sandbox through the gVisor RuntimeClass. The body defers gVisor to Later item 6, which runs only if the browser later gets egress to internal Services; this item's egress is public only.
- Chosen: Run Chromium with
- May the cluster browser open the tunnel hosts through the Cloudflare Access home-IP bypass?: Yes. The owner answered decision 2 on 2026-11-13: keep the bypass. The cluster runs an Access application whose policy
homelab-public-ip-bypassadmits the current public address of the workstation, so a pod that egresses through that address opens the tunnel hosts without an Access login. The cluster browser may use that path, which serves the scraping and change-validation consumers, and the accepted risk is in the Security section of the body. Proof (f) records only a count or a status code. (best practice) [sources: k8s/README.md:928, config.example.yaml:195]- Chosen: Keep the home-IP bypass for the cluster browser. The owner answered keep it on 2026-11-13; the bypass already admits the homelab public address, and it has value for scraping and change validation, with the risk recorded.
- Rejected: Block the browser from the tunnel hosts. It removes consumer 3 (change validation and scraping of the hosted UIs) from the item.
- Who creates Secret
devops/browserand itsws-pathvalue?: A person runsdevops k8s push-secrets --only devops/browserbefore the merge, and that run is the only owner step for the Secret. The rule of the cluster Secret table is that a person runs the push from the branch of the pull request before the merge of the manifest that reads the new Secret, and an agent writes no secret value. The rowbrowser_ws_pathlands with this item, which adds the Secret's consumer, and it adopts the live value when the keyring holds none, else generates 64 hex. The Deployment reads the key through an optionalsecretKeyRef, so a missing object gives the clear exit message of the start script and notCreateContainerConfigError. (a person decides) [sources: k8s/README.md:736, src/devops_cli/k8s/cluster_secrets.py:220]
Open questions
- Who creates Secret
devops/browserand itsws-pathvalue? (a person decides)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 13, 2026
Both give agents browser access, but this item deploys the k8s browser server and dan-petty/devops-cli#5348 configures the devcontainer to connect to it.dan-petty commentedon Nov 13, 2026
Decision for the Open WebUI follow-up: wait for an Open WebUI release that pins Playwright 1.65 or later. Do not run a second server at 1.60. Open WebUI does not use a remote browser today, and a second server doubles the image, the pins and the Renovate group for one optional loader. When Renovate brings such a release, set the client label on the Open WebUI pod and the two settings (
web.loader.engine=playwright,web.loader.playwright_ws_url= the in-cluster endpoint with the path).dan-petty commentedon Nov 13, 2026
Dependency of the
runtimeClassNamechange: #5434.When this item sets
runtimeClassName: gvisoron the browser pod, it depends on #5434. The measurement of dan-petty/devops-cli#5434 shows that the CPU and memory limits of a pod hold underrunsc, and that headless Chromium works underrunsc(a page load took 1.4 s, against 0.7 s underrunc). Its pull request setsoverhead.podFixedof RuntimeClassgvisorto memory16Mi. Set the class only after that pull request merges. Under the policy of #5447, the owner approves the first workload of the class.devops-cli-service commentedon Nov 17, 2026
Alternatives check: in-use
Reason: Web searches on remote headless-browser servers returned mostly generic pages, but the fact reads confirm
microsoft/playwrightis an active Apache-2.0 project whose official image runsrun-server, the WebSocket Playwright-protocol server, and whose PyPI client package (and bundled MCP server) give the screenshots, DOM, console and viewport control the issue needs. That one tool covers the whole need; the cluster gating, path secret and alerts around it are configuration, and the issue already names Playwright as a dependency the project uses.The item already names this tool.
Tool: microsoft/playwright (https://github.com/microsoft/playwright)
Covers:
run-server) in the pinned MCR image serves the Playwright protocol over WebSocket, which agent MCP clients, Python/Node scripts and in-cluster services all speakexposeNetworkfor local previewschromium.connect(playwright_ws_url)--path,--max-clientsand--hostinrun-serversupply the private connection path and the client cap the item needsLacks:
run-serverhas no authentication and no metrics endpoint, so NetworkPolicy ingress, the private path, Pod Security and cAdvisor-based alerts must be added as repository configurationTools considered:
Searches run:
Sources:
Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 17, 2026
Owner question: Does the owner approve the browser pod as the first workload of RuntimeClass gvisor? (a person decides)
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 21, 2026
Owner question: See the first point of Open questions in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
dan-petty commentedon Nov 26, 2026
Facts of 2026-11-26 for this item, after the owner named the idea again ("run a playwright pod in homelab and use it with various services").
playwrightand the settingPLAYWRIGHT_WS_URL(web.loader.playwright_ws_url). Since dan-petty/homelab#401 its settings come fromk8s/llm/values-open-webui.yaml, so two variables connect it:WEB_LOADER_ENGINE=playwrightandPLAYWRIGHT_WS_URL.importlib.metadata.version("playwright")in the live pod of Open WebUI 0.13.5 gives1.60.0. A server of another minor release refuses the connection (the 428 of the earlier test), so a server for Open WebUI is a 1.60 release./healthwith 401, so its use from Open WebUI needs a bearer value in the namespacellm(dan-petty/homelab#403). A Playwright server needs the path value of its WebSocket and a NetworkPolicy, and Open WebUI speaks its protocol with no adapter.llmalready lets the Open WebUI pod call a pod of another namespace. One NetworkPolicy on the server side admits the namespacellm, assearxng-open-webuiof dan-petty/homelab does for SearXNG. kube-router needs the namespace as the only peer when the rule hasports.dan-petty commentedon Dec 1, 2026
Re-scope of 2026-12-01
The owner decided on 2026-12-01 to replace Crawl4AI with this browser server and a client in devops-cli. This item cannot be built as its body says:
.github/workflows/third-party-image-scan.yml, which the body extends.playwrightcomes fromuv.lock.uv.lockdoes not hold it. feat(devcontainer): connect agent sessions to the cluster browser #5348 adds it.Measured on 2026-12-01
Server (image
v1.65.0-noble, rootless Podman, read-only root, user 1001, no capability):GET /answers 200 with--pathset, so anhttpGetprobe is sufficient.Listening on ws://0.0.0.0:3000/<path>writes the secret path to stdout. Acceptance (g) fails for this body. The base discards stdout. Errors still reach stderr.pwuseris uid 1001, gid 1001.Text of 9 public pages, pages that keep each expected string:
inner_text("body")markdownifyextracthtml2txt/mdfitNo method found one expected string of the GitHub repository page.