Minikube is an interactive Kubernetes system orchestrating Docker containers that can be used locally for testing purpose
- Install minikube (this config is for MAC); and for other platforms, follow this
brew cask install minikube
# check version
minikube version
or
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.30.0/minikube-darwin-amd64 && chmod +x minikube && sudo cp minikube /usr/local/bin/ && rm minikube
- Let’s config Kubernetes system in an interactive mode; what we need first is to start minikube
minikube start
# check status
minikube status
- Now, try to launch the minikube dashboard; launching minikube dashboard will take you to the default browser with the interface as seen below,
minikube dashboard
# to get the url alone
minikube dashboard --url=true


- Now, click on the create link text on top-corner of the dashboard page

- Import the below kubernetes_selenium_grid.json file created by me that generates a Selenium hub service, 1 Hub and, 1 Chrome Node; you can actually increase the Nodes manually from the dashboard itself

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "kind": "Service", | |
| "apiVersion": "v1", | |
| "metadata": { | |
| "name": "selenium-hub", | |
| "labels": { | |
| "run": "selenium-hub" | |
| } | |
| }, | |
| "spec": { | |
| "ports": [ | |
| { | |
| "protocol": "TCP", | |
| "port": 4444, | |
| "targetPort": 4444 | |
| } | |
| ], | |
| "selector": { | |
| "run": "selenium-hub" | |
| }, | |
| "type": "NodePort", | |
| "externalTrafficPolicy": "Cluster" | |
| } | |
| } | |
| { | |
| "kind": "Deployment", | |
| "apiVersion": "apps/v1", | |
| "metadata": { | |
| "name": "selenium-hub", | |
| "labels": { | |
| "run": "selenium-hub" | |
| } | |
| }, | |
| "spec": { | |
| "replicas": 1, | |
| "selector": { | |
| "matchLabels": { | |
| "run": "selenium-hub" | |
| } | |
| }, | |
| "template": { | |
| "metadata": { | |
| "labels": { | |
| "run": "selenium-hub" | |
| } | |
| }, | |
| "spec": { | |
| "containers": [ | |
| { | |
| "name": "selenium-hub", | |
| "image": "selenium/hub:3.14.0", | |
| "ports": [ | |
| { | |
| "containerPort": 4444, | |
| "protocol": "TCP" | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| } | |
| { | |
| "kind": "Deployment", | |
| "apiVersion": "apps/v1", | |
| "metadata": { | |
| "name": "selenium-node-chrome", | |
| "labels": { | |
| "run": "selenium-node-chrome" | |
| } | |
| }, | |
| "spec": { | |
| "replicas": 1, | |
| "selector": { | |
| "matchLabels": { | |
| "run": "selenium-node-chrome" | |
| } | |
| }, | |
| "template": { | |
| "metadata": { | |
| "labels": { | |
| "run": "selenium-node-chrome" | |
| } | |
| }, | |
| "spec": { | |
| "containers": [ | |
| { | |
| "name": "selenium-node-chrome", | |
| "image": "selenium/node-chrome-debug:3.14.0", | |
| "env": [ | |
| { | |
| "name": "HUB_PORT_4444_TCP_ADDR", | |
| "value": "selenium-hub" | |
| }, | |
| { | |
| "name": "HUB_PORT_4444_TCP_PORT", | |
| "value": "4444" | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| } |
- Observe the Service created, which is up and running
kubectl get service


- Observe the created Selenium Hub and Chrome node, which is up and running
# to check all the deployments kubectl get deployments (or) kubectl get deployments --namespace default # to check all the pods (containers) kubectl get pods (or) kubectl get pods --namespace default

- Get the newly generated selenium Host address and Port number; here, selenium-hub is the custom service created by me
minikube service selenium-hub --url (or) minikube service --namespace default selenium-hub --url

- Now, configure the driver initialization
options = { 'chromeOptions' => { 'args' => ['disable-infobars', 'disable-gpu', 'privileged', 'ignore-certificate-errors'] } } caps = Selenium::WebDriver::Remote::Capabilities.chrome(options) @driver = Selenium::WebDriver.for :remote, :url => "http://192.168.99.100:30445/wd/hub", desired_capabilities: caps
- Run your tests, which will pick-up the chrome node that we actually created through Kubernetes




















