Selenium Grid is good for parallel execution but maintenance is a nightmare in an era where you see a frequent upgrades to browsers and corresponding drivers. No sooner the usage of automation framework / selenium grid increases, scalability and maintenance becomes a challenge. To address such issues, we do have solutions based on dockers, docker swarm etc. Having said that, there are some caveats in scaling, managing container health etc.
Below solution would try to address most of them. Major chunks of the solution include Selenium, Zalenium, Docker, Kubernetes and Amazon EKS.
This article would outline the process of deploying Selenium grid(Zalenium) on AWS (Amazon EKS) using Kubernetes and Helm.
What do we achieve with this setup..?
- Scalability: EKS can scale the nodes and pods as per the given configuration.
- Visibility: Zalenium provides a feature to view the live executions on the containers.
- Availability: Amazon EKS cluster makes selenium grid available all the time.
- Maintenance: Low maintenance as the containers are destroyed after each execution.
Pre-requisites:
- An active Amazon AWS account.
- IAM user is created in AWS account
- AWS CLI is connected to AWS account providing the user credentials using local powershell or any terminal
OR - Use AWS cloudshell which is automatically connected to logged in account.
- Install AWS CLI (for local terminal), kubectl, helm in the given order.
Lets Get Started!
First, Create cluster from AWS GUI.
- Open Amazon EKS console
- Choose Create Cluster
- Provide details like cluster name, k8s version, role
- Select VPC, security groups, endpoint access
- Further steps as shown on GUI which will make 'master' ready.
- Create Node Group (Amazon EC2) instances.
- Choose the cluster, to which the above node group should get attached.
- Select security group, resources etc.,
- Define min and max number no. of nodes.
Second, Create cluster using eksctl (The official CLI for Amazon EKS)
- Install eksctl using brew, chocolatey, scoop or curl.
- Run the below command to create cluster.
eksctl create cluster --name sel --region ap-south-1 --nodegroup-name selnodegrp-1 --node-type t2.micro --nodes 2
OR
Create a cluster.yaml file with the below instructions and execute the given command.
eksctl create cluster -f cluster.yaml - It takes around 5-10min to complete the whole task of creating a cluster (master) and EC2 instances (worker) nodes and attach nodes to the master.
- Create a namespace 'zalenium'
kubectl create namespace zalenium - Add the zalenium repository from git onto cluster.
- Search and confirm if the repo is created.
helm search repo zalenium - Install zalenium onto kubernetes cluster with the given configuration.
helm install my-grid --namespace zalenium zalenium-github/zalenium --set hub.serviceType="LoadBalancer" --set hub.basicAuth.enabled="true" --set hub.basicAuth.username="seluser" --set hub.basicAuth.password="Selpwd" kubectl get service my-grid-zalenium --namespace="zalenium"
- Verify if the service is created and up
kubectl get service my-grid-zalenium --namespace="zalenium"
Validate the below URLs are accessible & then start the execution.
(Provide the credentials when prompted for)
- Cluster & nodes created from eksctl can be deleted similarly with a single command
Automation testing has become a critical component in the software development lifecycle, enabling faster, more reliable, and efficient testing processes. At APTRON Solutions, we offer a comprehensive Automation Testing Course in Noida designed to equip students with the necessary skills and knowledge to excel in this field. Our course is tailored to meet the growing demand for automation testing professionals in the IT industry.
ReplyDelete
ReplyDeleteMY ELEGANTE SMART HOME Upgrade your home with the latest in smart home automation technology. Improve your day-to-day life with automated lighting, climate control, security systems, and more. Create a connected home that runs on your terms - conveniently and effortlessly.
https://myelegante.in/home-automation-services/