Selenium in kubernetes - Only local connections are allowed

6/20/2019

I am trying to run an application which runs Selenium in order to take some screenshots.

When I am running the application in a docker compose file it all works fine, however, when I try to run in in a kubernetes cluster in the cloud I keep on getting the following message:Only local connections are allowed, and no connections seem to be established. To my mind the issue is due to networking and selenium does not allow connections which are not coming from localhost, as is the case in kubernetes.

I am using image: selenium/standalone-chrome image (selenium/standalone-chrome:3.141 in my chart), where apparently the chrome driver is: 2.43.600233

I have been trying to counter this with the --whitelisted-ips option, but to no avail. I have tried:

chromeOptions.addArguments("--whitelisted-ips");
chromeOptions.addArguments("--whitelisted-ips=");
chromeOptions.addArguments("--whitelisted-ips=''");

Here is some of my java code.

import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.TakesScreenshot;
chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--verbose");
chromeOptions.addArguments("--headless");
chromeOptions.addArguments("--whitelisted-ips=");
chromeOptions.addArguments("--disable-gpu");

Here is what I seen in the logs.

enter image description here

-- deann
java
kubernetes
selenium
selenium-chromedriver
selenium-webdriver

0 Answers