Update selenium examples to use deployments and newer selenium
This commit is contained in:
parent
1404d1a02b
commit
cd409d6f3e
|
@ -15,13 +15,13 @@ Your cluster must have 4 CPU and 6 GB of RAM to complete the example up to the s
|
||||||
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(not to be confused with Kubernetes nodes). We only need one hub, but we're using a replication controller to ensure that the hub is always running:
|
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(not to be confused with Kubernetes nodes). We only need one hub, but we're using a replication controller to ensure that the hub is always running:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
kubectl create --filename=examples/selenium/selenium-hub-rc.yaml
|
kubectl create --filename=staging/selenium/selenium-hub-deployment.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
The Selenium Nodes will need to know how to get to the Hub, let's create a service for the nodes to connect to.
|
The Selenium Nodes will need to know how to get to the Hub, let's create a service for the nodes to connect to.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
kubectl create --filename=examples/selenium/selenium-hub-svc.yaml
|
kubectl create --filename=staging/selenium/selenium-hub-svc.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
### Verify Selenium Hub Deployment
|
### Verify Selenium Hub Deployment
|
||||||
|
@ -59,7 +59,7 @@ curl http://localhost:4444
|
||||||
If you are using Google Container Engine, you can expose your hub via the internet. This is a bad idea for many reasons, but you can do it as follows:
|
If you are using Google Container Engine, you can expose your hub via the internet. This is a bad idea for many reasons, but you can do it as follows:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
kubectl expose rc selenium-hub --name=selenium-hub-external --labels="app=selenium-hub,external=true" --type=LoadBalancer
|
kubectl expose deployment selenium-hub --name=selenium-hub-external --labels="app=selenium-hub,external=true" --type=LoadBalancer
|
||||||
```
|
```
|
||||||
|
|
||||||
Then wait a few minutes, eventually your new `selenium-hub-external` service will be assigned a load balanced IP from gcloud. Once `kubectl get svc selenium-hub-external` shows two IPs, run this snippet.
|
Then wait a few minutes, eventually your new `selenium-hub-external` service will be assigned a load balanced IP from gcloud. Once `kubectl get svc selenium-hub-external` shows two IPs, run this snippet.
|
||||||
|
@ -79,13 +79,13 @@ Now that the Hub is up, we can deploy workers.
|
||||||
This will deploy 2 Chrome nodes.
|
This will deploy 2 Chrome nodes.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
kubectl create --filename=examples/selenium/selenium-node-chrome-rc.yaml
|
kubectl create --filename=staging/selenium/selenium-node-chrome-deployment.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
And 2 Firefox nodes to match.
|
And 2 Firefox nodes to match.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
kubectl create --filename=examples/selenium/selenium-node-firefox-rc.yaml
|
kubectl create --filename=staging/selenium/selenium-node-firefox-deployment.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
Once the pods start, you will see them show up in the Selenium Hub interface.
|
Once the pods start, you will see them show up in the Selenium Hub interface.
|
||||||
|
@ -160,8 +160,8 @@ Congratulations, your Selenium Hub is up, with Firefox and Chrome nodes!
|
||||||
If you need more Firefox or Chrome nodes, your hardware is the limit:
|
If you need more Firefox or Chrome nodes, your hardware is the limit:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
kubectl scale rc selenium-node-firefox --replicas=10
|
kubectl scale deployment selenium-node-firefox --replicas=10
|
||||||
kubectl scale rc selenium-node-chrome --replicas=10
|
kubectl scale deployment selenium-node-chrome --replicas=10
|
||||||
```
|
```
|
||||||
|
|
||||||
You now have 10 Firefox and 10 Chrome nodes, happy Seleniuming!
|
You now have 10 Firefox and 10 Chrome nodes, happy Seleniuming!
|
||||||
|
@ -185,9 +185,9 @@ Adapted from: https://github.com/SeleniumHQ/docker-selenium
|
||||||
To remove all created resources, run the following:
|
To remove all created resources, run the following:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
kubectl delete rc selenium-hub
|
kubectl delete deployment selenium-hub
|
||||||
kubectl delete rc selenium-node-chrome
|
kubectl delete deployment selenium-node-chrome
|
||||||
kubectl delete rc selenium-node-firefox
|
kubectl delete deployment selenium-node-firefox
|
||||||
kubectl delete deployment selenium-python
|
kubectl delete deployment selenium-python
|
||||||
kubectl delete svc selenium-hub
|
kubectl delete svc selenium-hub
|
||||||
kubectl delete svc selenium-hub-external
|
kubectl delete svc selenium-hub-external
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
apiVersion: v1
|
apiVersion: apps/v1
|
||||||
kind: ReplicationController
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: selenium-hub
|
name: selenium-hub
|
||||||
labels:
|
labels:
|
||||||
|
@ -7,6 +7,7 @@ metadata:
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
|
matchLabels:
|
||||||
app: selenium-hub
|
app: selenium-hub
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
|
@ -15,7 +16,7 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: selenium-hub
|
- name: selenium-hub
|
||||||
image: selenium/hub:2.53.0
|
image: selenium/hub:3.11
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 4444
|
- containerPort: 4444
|
||||||
resources:
|
resources:
|
|
@ -1,5 +1,5 @@
|
||||||
apiVersion: v1
|
apiVersion: apps/v1
|
||||||
kind: ReplicationController
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: selenium-node-chrome
|
name: selenium-node-chrome
|
||||||
labels:
|
labels:
|
||||||
|
@ -7,6 +7,7 @@ metadata:
|
||||||
spec:
|
spec:
|
||||||
replicas: 2
|
replicas: 2
|
||||||
selector:
|
selector:
|
||||||
|
matchLabels:
|
||||||
app: selenium-node-chrome
|
app: selenium-node-chrome
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
|
@ -15,7 +16,7 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: selenium-node-chrome
|
- name: selenium-node-chrome
|
||||||
image: selenium/node-chrome-debug:2.53.0
|
image: selenium/node-chrome-debug:3.11
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 5900
|
- containerPort: 5900
|
||||||
env:
|
env:
|
|
@ -1,5 +1,5 @@
|
||||||
apiVersion: v1
|
apiVersion: apps/v1
|
||||||
kind: ReplicationController
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: selenium-node-firefox
|
name: selenium-node-firefox
|
||||||
labels:
|
labels:
|
||||||
|
@ -7,17 +7,25 @@ metadata:
|
||||||
spec:
|
spec:
|
||||||
replicas: 2
|
replicas: 2
|
||||||
selector:
|
selector:
|
||||||
|
matchLabels:
|
||||||
app: selenium-node-firefox
|
app: selenium-node-firefox
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: selenium-node-firefox
|
app: selenium-node-firefox
|
||||||
spec:
|
spec:
|
||||||
|
volumes:
|
||||||
|
- name: dshm
|
||||||
|
emptyDir:
|
||||||
|
medium: Memory
|
||||||
containers:
|
containers:
|
||||||
- name: selenium-node-firefox
|
- name: selenium-node-firefox
|
||||||
image: selenium/node-firefox-debug:2.53.0
|
image: selenium/node-firefox-debug:3.11
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 5900
|
- containerPort: 5900
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /dev/shm
|
||||||
|
name: dshm
|
||||||
env:
|
env:
|
||||||
- name: HUB_PORT_4444_TCP_ADDR
|
- name: HUB_PORT_4444_TCP_ADDR
|
||||||
value: "selenium-hub"
|
value: "selenium-hub"
|
Loading…
Reference in New Issue