Skip to content

[πŸ› Bug]: Not being able to record session using selenium ffmpeg4 in kubernetesΒ #2644

@rgeko

Description

@rgeko

What happened?

I'm trying to record a session using selenium ffmpeg4 in kubernetes but the video pod fails to record (output is in logs below).

The Kubernetes deployment and services files are the following
`
apiVersion: v1
kind: PersistentVolume
metadata:
name: selenium-outputs-pv
spec:
capacity:
storage: 5Gi # Combined storage
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: selenium-storage
hostPath:
path: /mnt/data/selenium-outputs # Single storage location


apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: selenium-outputs-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi
storageClassName: selenium-storage


apiVersion: apps/v1
kind: Deployment
metadata:
name: selenium-node-chrome
labels:
app: selenium
spec:
replicas: 1
selector:
matchLabels:
app: selenium-node-chrome
template:
metadata:
labels:
app: selenium-node-chrome
spec:
containers:
- name: selenium-node-chrome
image: selenium/node-chrome:120.0.6099.62-chromedriver-120.0.6099.62
ports:
- containerPort: 5555
name: bind
- containerPort: 5900
name: vnc
- containerPort: 7900
name: no-vnc
env:
- name: SE_NODE_HOST
value: "selenium-node-chrome"
- name: SE_EVENT_BUS_HOST
value: "selenium-hub"
- name: SE_EVENT_BUS_PUBLISH_PORT
value: "4442"
- name: SE_EVENT_BUS_SUBSCRIBE_PORT
value: "4443"
volumeMounts:
- mountPath: /dev/shm
name: dshm
- mountPath: /home/seluser/Downloads
name: selenium-outputs
subPath: downloads
volumes:
- name: dshm
emptyDir: {}
- name: selenium-outputs
persistentVolumeClaim:
claimName: selenium-outputs-pvc


apiVersion: apps/v1
kind: Deployment
metadata:
name: chrome-video
labels:
app: selenium
spec:
replicas: 1
selector:
matchLabels:
app: chrome-video
template:
metadata:
labels:
app: chrome-video
spec:
containers:
- name: chrome-video
image: selenium/video:ffmpeg-4.3.1-20230421
env:
- name: DISPLAY_CONTAINER_NAME
value: "selenium-node-chrome"
- name: FILE_NAME
value: "chrome_video.mp4"
- name: SE_SCREEN_WIDTH
value: "1920"
- name: SE_SCREEN_HEIGHT
value: "1080"
volumeMounts:
- name: selenium-outputs
mountPath: /videos
subPath: videos
volumes:
- name: selenium-outputs
persistentVolumeClaim:
claimName: selenium-outputs-pvc


apiVersion: apps/v1
kind: Deployment
metadata:
name: selenium-hub
labels:
app: selenium
spec:
replicas: 1
selector:
matchLabels:
app: selenium-hub
template:
metadata:
labels:
app: selenium-hub
spec:
containers:
- name: selenium-hub
image: selenium/hub:4.19.0
ports:
- containerPort: 4442
- containerPort: 4443
- containerPort: 4444
livenessProbe:
httpGet:
path: /status
port: 4444
initialDelaySeconds: 10
periodSeconds: 15
timeoutSeconds: 30
readinessProbe:
httpGet:
path: /status
port: 4444
initialDelaySeconds: 5
periodSeconds: 10

apiVersion: v1
kind: Service
metadata:
name: selenium-hub
spec:
selector:
app: selenium-hub
ports:
- name: event-bus-publish
port: 4442
- name: event-bus-subscribe
port: 4443
- name: webdriver
port: 4444
type: ClusterIP


apiVersion: v1
kind: Service
metadata:
name: selenium-node-chrome
spec:
selector:
app: selenium-node-chrome
ports:
- name: bind
port: 5555
targetPort: 5555
- name: vnc
protocol: TCP
port: 5900 # Internal service port
targetPort: 5900 # Container port
- name: no-vnc
port: 7900
type: ClusterIP
`

Command used to start Selenium Grid with Docker (or Kubernetes)

kubectl apply -f selenium

Relevant log output

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 @ 0x558641e60b80] Cannot open display selenium-node-chrome:99.0, error 1.
selenium-node-chrome:99.0: Input/output error
2025-02-06 16:03:31,421 INFO exited: video-recording (exit status 1; not expected)

Operating System

Kubernetes

Docker Selenium version (image tag)

selenium/video:ffmpeg-4.3.1-20230421

Selenium Grid chart version (chart version)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions