docker-selenium icon indicating copy to clipboard operation
docker-selenium copied to clipboard

[🐛 Bug]: Not able to access live preview in Kubernetes

Open lirankremer opened this issue 3 years ago • 3 comments

What happened?

Hi We have deployed Selenium Grid 4 in our kubernetes cluster. When we trying to access live preview, we getting blank page in UI attached the ymls I use i see the deployments- NAME READY UP-TO-DATE AVAILABLE AGE selenium-hub 1/1 1 1 41d selenium-node-chrome 2/2 2 2 23d chrome-video 2/2 2 2 29d

hub.txt hub-svc.txt chrome_video_deployment.yaml.txt chrome_video_claim0_persistentvolumeclaim.txt chrome_node.txt

Command used to start Selenium Grid with Docker

I do not use Docker

Relevant log output

if it helps, in the log of the - selenium-node-chrome
I see:

11:48:13.433 INFO [ProtocolHandshake.createSession] - Detected upstream dialect: W3C
11:48:13.434 WARN [ProtocolHandshake.createSession] - Support for Legacy Capabilities is deprecated; You are sending the following invalid capabilities: [build, tz, idleTimeout, name, screenResolution, platform]; Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
11:48:13.438 INFO [LocalNode.newSession] - Session created by the Node. Id: 56fc8eafd93e89119e55d46266efcc42, Caps: Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 104.0.5112.79, chrome: {chromedriverVersion: 104.0.5112.79 (3cf3e8c8a07d..., userDataDir: /tmp/.com.google.Chrome.WPxpTH}, goog:chromeOptions: {debuggerAddress: localhost:45701}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: LINUX, proxy: Proxy(), se:cdp: http://localhost:45701, se:cdpVersion: 104.0.5112.79, se:vncEnabled: true, se:vncLocalAddress: ws://10.42.0.136:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
11:49:47.147 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "b120f492361f19e3de6adc2f8ffe5031","eventTime": 1662292187146490469,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "192.168.40.37:30001","http.method": "POST","http.request_content_length": "4796","http.scheme": "HTTP","http.status_code": 500,"http.target": "\u002fsession\u002f56fc8eafd93e89119e55d46266efcc42\u002fexecute\u002fasync","http.user_agent": "selenium\u002f4.3.0 (java windows)"}}

the status of the grid is: { "value": { "ready": true, "message": "Selenium Grid ready.", "nodes": [ { "id": "be0b4658-4fb1-41ed-9645-bcba89a3cc99", "uri": "http:\u002f\u002f10.42.0.136:5555", "maxSessions": 1, "osInfo": { "arch": "amd64", "name": "Linux", "version": "3.10.0-1160.76.1.el7.x86_64" }, "heartbeatPeriod": 60000, "availability": "UP", "version": "4.4.0 (revision e5c75ed026a)", "slots": [ { "lastStarted": "2022-09-15T10:41:44.556525Z", "session": null, "id": { "hostId": "be0b4658-4fb1-41ed-9645-bcba89a3cc99", "id": "7e7984af-d479-405f-b5c9-9dc8b3001e38" }, "stereotype": { "browserName": "chrome", "browserVersion": "104.0", "platformName": "LINUX", "se:noVncPort": 7900, "se:vncEnabled": true } } ] }, { "id": "16470025-78bd-4f5e-b027-0f958ff8bd7c", "uri": "http:\u002f\u002f10.42.0.135:5555", "maxSessions": 1, "osInfo": { "arch": "amd64", "name": "Linux", "version": "3.10.0-1160.76.1.el7.x86_64" }, "heartbeatPeriod": 60000, "availability": "UP", "version": "4.4.0 (revision e5c75ed026a)", "slots": [ { "lastStarted": "2022-09-15T10:41:04.628742Z", "session": null, "id": { "hostId": "16470025-78bd-4f5e-b027-0f958ff8bd7c", "id": "255588ef-fa03-45c0-a707-0dab2422fb0d" }, "stereotype": { "browserName": "chrome", "browserVersion": "104.0", "platformName": "LINUX", "se:noVncPort": 7900, "se:vncEnabled": true } } ] } ] } }



### Operating System

CentoOs7

### Docker Selenium version (tag)

4.0.0

lirankremer avatar Sep 15 '22 11:09 lirankremer

Hi @lirankremer I am not familiar with Kubernetes, but I'll do the best I can to share my thoughts on what you might be facing.

noVNC runs on the selenium/node-chrome containers and is exposed from that container via port 7900. However, in your configuration, I can see port 7900 appears to be open on the selenium/hub.

Have you tried connecting directly to the node-chrome instances via port 7900 instead?

jamesmortensen avatar Sep 20 '22 16:09 jamesmortensen

Hi James can U explain where should I configure the port? because I think I already did it via Yaml

apiVersion: v1 kind: Service metadata: name: selenium-hub-svc-np labels: app: selenium-hub-svc-np spec: ports:

  • port: 4444 targetPort: 4444 nodePort: 30001 name: port0
  • port: 4442 targetPort: 4442 name: "4442"
  • port: 4443 targetPort: 4443 name: "4443"
  • port: 7900 targetPort: 7900 name: "7900"
  • port: 5900 targetPort: 5900 name: "5900" selector: app: selenium-hub type: NodePort sessionAffinity: None ~

[root@snc-centos70181 ~]# kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.43.0.1 443/TCP 49d selenium-hub-svc-np NodePort 10.43.2.161 4444:30001/TCP,4442:31443/TCP,4443:31710/TCP,7900:30569/TCP,5900:30260/TCP 47d

also, how can i check what U asked? "Have you tried connecting directly to the node-chrome instances via port 7900 instead?"

lirankremer avatar Sep 21 '22 12:09 lirankremer

@lirankremer you have configured port 7900, but it appears you have configured it to forward to the selenium-hub. The hub has no X server or VNC server as it only forwards WebDriver commands to the individual nodes.

The nodes, on the other hand, have X servers, xvfb, fluxbox, and other tools to give the browsers the graphical environment needed for them to execute properly. The nodes also have the VNC server and noVNC client running, listening on port 7900 for noVNC.

Have you tried configuring port 7900 here instead? https://github.com/SeleniumHQ/docker-selenium/files/9574860/chrome_node.txt?

Since I am not familiar with Kubernetes, I am not sure how the port allocation works with scaling. Each node would need to expose a different port. For instance, if you have two node-chrome containers, you would need to map 7900:7900 and then 7901:7900 and so forth.

Hope this helps!

jamesmortensen avatar Sep 24 '22 04:09 jamesmortensen

Hi James thank you for the idea, it did helped :) now the last issue ( I hope), i have a problem with the recording process

Waiting before next display check... Waiting before next display check... Waiting before next display check... ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04) configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-fontconfig --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libbluray --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-libsrt --enable-libaribb24 --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 [x11grab @ 0x562e0e349b80] Cannot open display selenium:99.0, error 1. selenium:99.0: Input/output error 2022-11-01 12:00:41,944 INFO exited: video-recording (exit status 1; not expected)

any thoughts about how i pass this issue?

lirankremer avatar Nov 01 '22 20:11 lirankremer

Great to know it works now, the password is secret. See step 4 https://github.com/SeleniumHQ/docker-selenium#quick-start

diemol avatar Nov 02 '22 10:11 diemol

thank you :) any idea why i get an error trying to record the video? [x11grab @ 0x559f154e5b80] Cannot open display selenium:99.0, error 1. selenium:99.0: Input/output error

lirankremer avatar Nov 02 '22 11:11 lirankremer

Not sure, I imagine you have both containers in a single pod, so it should work. If you have more questions, please join us in the IRC/Slack channel where the community can help you as well.

diemol avatar Nov 02 '22 11:11 diemol

I hit the same issue @lirankremer do u have any solution for that ? thx

auddddrey avatar Mar 07 '23 16:03 auddddrey

Hi @lirankremer can you please share how you have set the vnc port and where?

kherath17 avatar Nov 01 '23 13:11 kherath17

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Dec 09 '23 00:12 github-actions[bot]