Scaling your Automation using Selenium with Kubernetes(Minikube) and Docker on macOS BigSur

After so much time wasted on setting up a working environment with Kubernetes and selenium on a macOS BigSur using Minikube, decided to write this blog to make it easier for whoever wants to set it up next.

Homebrew installs the stuff you need that Apple (or your Linux system) didn’t.

Homebrew installs packages to their own directory and then symlinks their files into /usr/local.

Type following command in terminal to install Homebrew

$ /bin/bash -c "$(curl -fsSL

brew install minikube

brew install kubernetes-cli


Install virtual box from

ake virtualbox the default driver

minikube config set vm-driver virtualbox

If an HTTP proxy is required to access the internet, you may need to pass the proxy connection information to both minikube and Docker using environment variables

Step 6.1: Open .bash_profile on mac terminal

nano .bash_profile

Step 6.2: Update the following as required(Note: )

export HTTP_PROXY=http://<proxy hostname:port>
export HTTPS_PROXY=https://<proxy hostname:port>
export NO_PROXY=localhost,,,,

Note: As I did not require HTTP_PROXY, HTTPS_PROXY to run locally, have set only NO_PROXY

Step 6.3: Refresh .bash_profile on mac terminal

source .bash_profile

More information on Proxy :

  • HTTP_PROXY - The URL to your HTTP proxy
  • HTTPS_PROXY - The URL to your HTTPS proxy
  • NO_PROXY - A comma-separated list of hosts which should not go through the proxy.

The NO_PROXY variable here is important: Without setting it, minikube may not be able to access resources within the VM. minikube uses two IP ranges, which should not go through the proxy:

  • : Used by the minikube VM. Configurable for some hypervisors via --host-only-cidr
  • : Used by the minikube kvm2 driver.
  • : Used by the minikube docker driver’s first cluster.
  • : Used by service cluster IP’s. Configurable via --service-cluster-ip-range

One important note: If NO_PROXY is required by non-Kubernetes applications, such as Firefox or Chrome, you may want to specifically add the minikube IP to the comma-separated list, as they may not understand IP ranges.

docker pull elgalu/selenium:latestdocker pull selenium/node-firefoxdocker pull selenium/node-chromedocker pull selenium/hub:4.0.0docker pull selenium/base:4.0docker pull selenium/node-base
You can run from docker GUI and ensure its running

minikube start

Please enter your system password when prompted for giving sudo permissions.

We will be using Selenium Grid Hub to make our Selenium install scalable via a master/worker model. The Selenium Hub is the master, and the Selenium Nodes are the workers. We only need one hub, but we’re using a replication controller to ensure that the hub is always running.

Create an folder on mac where you will be storing all configuration files and cd to the folder

mkdir Selenium-kubernetes
cd Selenium-kubernetes

Create new deployment script file required in the above folder

nano selenium-hub-deployment.yaml

Use the following configuration for the file and save and close the file by using

By adding we can change the hub’s version and after this, we can apply the changes without re-creation the deployment.

kubectl create -f selenium-hub-deployment.yaml

Create an file with the below name and save it with the below content

nano selenium-hub-service.yaml

Use the following configuration for the file and save and close the file by using

Note : “selenium-hub-service.yaml” service was created and we connected it with our hub and our nodePort is 30009 which means we can reach the hub with this port.


kubectl create -f selenium-hub-service.yaml

Let’s verify our deployment of the service by the below command.

kubectl describe service
Observe that the endpoint is and the node port is 30009, we can use this to connect our hub via

Deploy Firefox and Chrome Nodes:

Now that the Hub is up, we can deploy workers. We will deploy 2 Chrome nodes And 2 Firefox nodes using two separate files and deploy them.

Create two files and

Chrome Replication controller

Firefox Replication controller

ets go ahead deploy them

kubectl create -f selenium-node-chrome-deployment.yaml
kubectl create -f selenium-node-firefox-deployment.yaml

ets expose this service to view on mac browser

kubectl expose deployment selenium-hub — type=NodePort

To Access the selenium-hub url

minikube service selenium-hub --url

Automation Test Engineer by Profession, Traveller by the Weekend