Selenium Chrome Node doesn't resolve urls on kubernetes with Scalatest

6/22/2018

I'm using Scalatest and Selenium for testing. The Selenium Hub and the Chrome node are running on 2 Kubernetes Pods.
I have the webservice I need to test on another pod. It has an internal address http://myui.dev/. It's not accessible from outside.
The test continue to fail. When the webdriver is trying to reaching the internal url the page is getting is the ERR_CONNECTION_TIMED_OUT page on Chrome.

I tried to:

  • connect from scalatest to another url (www.google.co.uk) and it worked.
  • I've tried to access the the selenium hub container and I can curl either google or my internal url.
  • I've accessed the pod with the chrome node and curl the url. It worked as well.

So, my best guess it's that for some reason it's not taking or overriding the /etc/resolv.conf inside the container.

Any idea how to fix this?

Some configuration that could be helpful:

  • scalatest version: 3.0.5
  • selenium-java version: 3.12.0
  • Selenium Hub image: selenium/hub:latest
  • Selenium Chrome node image: selenium/node-chrome:latest

The pod configuration:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
     service: selenium-chrome
  name: selenium-chrome
spec:
  replicas: 1
  strategy: {}
  template:
    metadata:
      labels:
        service: selenium-chrome
    spec:
      containers:
      - env:
        - name: HUB_HOST
          value: selenium-hub
        - name: NODE_MAX_INSTANCES
          value: "10"
        - name: NODE_MAX_SESSION
          value: "10"                
        image: selenium/node-chrome:latest
        name: selenium-chrome
        volumeMounts:
            - mountPath: /dev/shm
              name: extended-mem
        imagePullPolicy: Always
        resources: {}
      restartPolicy: Always
      volumes:
        # extended memory for the browser
        - name: extended-mem
          hostPath:
            path: /dev/shm
status: {}

UPDATE [25/06/2018]:
I've figure it out. Apparently wasn't a dns problem. As Matthew suggested it's not a DNS problem. Indeed when I run:

kubectl run selenium-hub --image selenium/hub --port 4444
kubectl expose deployment selenium-hub --type=NodePort
kubectl run selenium-node-chrome --image selenium/node-chrome --env="HUB_PORT_4444_TCP_ADDR=selenium-hub" --env="HUB_PORT_4444_TCP_PORT=4444"

it works.

-- Mike
google-chrome
kubernetes
scala
scalatest

0 Answers