Mount Persistence Volume using Zalenium helm charts

Kubernetes persistent volumes are an administrator provisioned volumes.

Note: This post explains you how to create & provision custom volumes through charts for Zalenium lovers. Charts is a new & easy approach for kubernetes to deploy containers; it has a structured pattern for templates in yaml format and a separate values.yaml file to provision containers.

Follow this hierarchy for quick understanding if you are a laymen to Helm charts:

deployment.yaml > pod-template.yaml > pvc-shared.yaml > values.yaml


Kubernetes deployment helps you manage & monitor containers

  • Make sure you mention the pod template file in deployment.yaml. See below snippet as in the existing deployment.yaml file
    {{- include "zalenium.podTemplate" . | nindent 4 }}


By default, Zalenium has defined a pod template with the name podTemplate. You can either create your own template or use the existing one. I have used the existing template and made some additions in it.

  • Create a volume with the hostPath containing local directory/file path that needs to be mounted inside the containers
  • Here, I named the volume as zalenium-shared
    - name: {{ template "zalenium.fullname" . }}-shared
        path: /Users/Username/local_dir_path/images/
  • And locate the target path inside containers
  - name: {{ template "zalenium.fullname" . }}-shared
    mountPath: /home/seluser/custom_directory


Persistence Volume Claim / PVCs are objects that request storage resources from your cluster

  • Create a file pvc-shared.yaml with request template containing key-pairs to be imported from the values.yamlfile
  • Here, I named storageClassName as zale_sharedand rest of the data were imported from values.yaml file


  • Provision containers with required size, access, etc., as below
    enabled: false
    useExisting: false
    name: zale_shared
    accessMode: ReadWriteMany
    size: 2Gi
  • For more details, see example GitHub repo

Zalenium Dockerized Selenium Grid

Zalenium provides docker images (Hub + Nodes) with the latest browser drivers, browsers, and tools (for any language bindings) required for Selenium automation. The containers created from these images can be scaled-up with simple CLI commands. By default, there will be two live containers up and running.

  • Open terminal and download the below images from Docker hub
docker pull elgalu/selenium
docker pull dosel/zalenium
  • Create docker containers and start Zalenium proxy in a single command
docker run --rm -ti --name zalenium -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/videos:/home/seluser/videos --privileged dosel/zalenium start
  • Now, configure the driver initialization
options = {
  'chromeOptions' => {
    'args' => ['disable-infobars', 'disable-gpu', 'privileged', 'ignore-certificate-errors']

caps =
@driver = Selenium::WebDriver.for :remote, :url => "", desired_capabilities: caps
  • Check out live test session using the below URL

  • Start monitoring the Zalenium live interface once the tests were triggered

  • You can also review tests through the recorded video stream

  • To stop the docker containers spun through Zalenium, simply exit Zalenium proxy using the below command
docker stop zalenium


Method #2 (most preferred approach)

Using this approach actually detaches the Zalenium process from running in the terminal

  • A single line command to start Zalenium proxy and make docker containers up
curl -sSL | bash -s start
  • Command to terminate the Zalenium proxy along with the running/exited containers
curl -sSL | bash -s stop
  • Scale up docker containers as desired; but, make sure you create replicas only if the machine has proper CPU (x4/x8/x16) cores specific to the containers
curl -sSL | bash -s start --desiredContainers 8 --screenWidth 1440 --screenHeight 900 --timeZone "Asia/Dubai" --maxDockerSeleniumContainers 10 --maxTestSessions 30 --videoRecordingEnabled true