Deploying Zalenium in Google Cloud using Kubernetes and Helm

Ashish Ghosh
3 min readNov 20, 2020

--

Executing automated tests on Selenium Grid is a logical solution when we think of running parallel concurrent UI tests using Selenium. In this article we will see how we can easily spin up a Selenium Grid in Google Cloud Platform.
Though I would be using Google Cloud for this article, the method and the commands can be easily used for any cloud/local set up.

Before we start, lets quickly understand the steps we will be following today.

  1. From the Google Cloud Platform Console, we will use the GKE (Google Kubernetes Engine) service to create a Kubernetes Cluster
  2. We will then connect to the cluster using Cloud Shell and run the Kubernetes/Helm commands to spin up Zalenium

Why Zalenium?

  • You can get video recordings of your test runs
  • It gives a dashboard where you can see all the tests that you executed by order of execution. You will see which browser was using if you were using integration with cloud services like Sauce Labs you will clearly see that what test was executed and the video that was recorded in the cloud service will be downloaded and added to the dashboard.
  • You can also have tests running in different viewports for example if you want to start trying to test your website into a mobile resolution.
  • There is very user-friendly and extensive documentation on the GitHub repository.
  • Zalenium can run in Docker, Kubernetes, AWS, Google Compute Engine and OpenShift.

Enough talk.. Let’s get started.

Step 1: Go to your Google Cloud Platform Console and search for GKE (Google Kubernetes Engine). If you do not have a GCP account you can create one by following these steps.

Step 2: Create a standard [Cluster] . I chose the following parameters. You can choose data that suits you.
a. Cluster Name : zalenium
b. Zone :
europe-west1-b
c. Number of Nodes :1
d. Machine Type : 2 vCPUs 8.00 GB

Create cluster from GKE

Step 3: Connect to the cluster by clicking on the [Run in Cloud Shell] button

Step 4: Once you are inside the shell, execute the following very simple commands :

kubectl create namespace zalenium

I chose my namespace as zalenium. You can give a name of your choice.

helm repo add zalenium-github https://raw.githubusercontent.com/zalando/zalenium/master/charts/zalenium

This will add the Zalenium Helm chart repository. zalenium-github is the name of this repo (you may call it whatever you want).

helm install my-release --namespace zalenium zalenium-github/zalenium --set hub.serviceType="LoadBalancer"

my-release is the Helm's release name.

Now execute the following command to get the External IP which can be used to access the Zalenium console from the browser.

kubectl get service my-release-zalenium --namespace="zalenium"

If you notice carefully, the IP that I get is 35.241.216.73. If I hit this IP followed by /grid/console in a browser , I should be able to view the Se Grid.

And Voila! Your Selenium Grid (Zalenium) is up and ready.
So the following can be used as the Hub URL in all your automated UI tests.

http://35.241.216.73/wd/hub

To view the execution videos, you can navigate to the Zalenium Dashboard using the following URL:

http://35.241.216.73/dashboard

Happy Testing!!

The commands I have used above are mostly from this GitHub project :

--

--

Ashish Ghosh

Test Automation Architect @ING Bank. Tech enthusiast. Innovation champion.