July 25, 2019 // By Josh Wencl
I figured I’d write a step by step guide to setting up a scalable selenium grid setup in kubernetes.
I’m doing this in Azure, simply because I have unspent Azure credits from my MSDN subscription.
You’re going to need a couple of things installed before you can continue, you probably already have some of these.
- Git
- Kubectl
- Azure CLI
I’m using Aerokube’s Moon project as my grid setup, you can find them here.
Setup a Kubernetes Cluster in Azure
After you setup a new kubernetes service in azure, you just need the to look at the properties.
After that’s setup you just need the resource group and the service name.
Connect to the Cluster
Kubectl is going to handle setting up our cluster, but we need to setup a configuration for this first. You can do this without the azure cli, but the azure cli makes it incredible easy to set this configuration up.
So start by logging in with the cli.
az login
It will open up your default web-browser to finish the login process.
Now we need to run another command to setup a configuration for kubectl to use.
Replace the name and resource group with your own.
az aks get-credentials -g <your resource group> -n <your service name>
This will add everything you need to your kubectl config.
This is the only thing we needed the azure cli for.
Clone the Aerokube/Moon Repository
You will have to clone the Aerokube/Moon repository, the command do that is this.
This will create a local repo in whichever directory you’re in.
finally, cd into the moon-deploy directory.
cd moon-deploy
Create Moon Pod
The last thing we’ll need to do is setup our pod, the talented people at Aerokube included a manifest file you can use to apply your configuration. So you only have to reference the manifest file to start it.
kubectl apply -f moon.yaml
This will setup moon for you. This will take about 2 minutes, so go get a drink while you wait.
You’ll see that its ready using the get svc command, once it has an external ip you’re ready to start testing.
kubectl get svc -n moon
Testing Your Cloud Hosted Hub
The UI for Selenoid is forwarded to port 8080, the hub is on port 4444.
You can open up a browser and navigate to the site to see if its accessible publicly.
If you can access both of those, you’re ready to run tests!
TL;DR
az login
az aks get-credentials -g K8Moon -n K8Moon
git clone https://github.com/aerokube/moon-deploy.git
cd moon-deploy
kubectl apply -f moon.yaml