<p>I have an Openshift 3 Cluster containing the two following containers: selenium-hub and selenium-node-chrome. Please see below the attached deployment and service yaml files.</p>
<p><strong>Hub Deployment:</strong></p>
<pre><code>apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
  labels:
    app: selenium-hub
    selenium-hub: master
  name: selenium-hub
spec:
  replicas: 1
  selector:
    type: selenium-hub
  template:
    metadata:
      labels:
        type: selenium-hub
      name: selenium-hub
    spec:
      containers:
        - image: 'selenium/hub:latest'
          imagePullPolicy: IfNotPresent
          name: master
          ports:
            - containerPort: 4444
              protocol: TCP
            - containerPort: 4442
              protocol: TCP
            - containerPort: 4443
              protocol: TCP
  triggers:
    - type: ConfigChange
</code></pre>
<p><strong>Hub Service:</strong></p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    app: selenium-hub
    selenium-hub: master
  name: selenium-hub
spec:
  ports:
    - name: selenium-hub
      port: 4444
      protocol: TCP
      targetPort: 4444
    - name: publish
      port: 4442
      protocol: TCP
      targetPort: 4442
    - name: subscribe
      port: 4443
      protocol: TCP
      targetPort: 4443
  selector:
    type: selenium-hub
  type: ClusterIP
</code></pre>
<p><strong>Node Deployment:</strong></p>
<pre><code>apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
  labels:
    app: selenium-node-chrome
  name: selenium-node-chrome
spec:
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    browser: chrome
  template:
    metadata:
      labels:
        app: node-chrome
        browser: chrome
      name: selenium-node-chrome-master
    spec:
      containers:
        - env:
            - name: SE_EVENT_BUS_HOST
              value: selenium-hub
            - name: SE_EVENT_BUS_PUBLISH_PORT
              value: '4442'
            - name: SE_EVENT_BUS_SUBSCRIBE_PORT
              value: '4443'
            - name: SE_NODE_HOST
              value: node-chrome
            - name: SE_NODE_PORT
              value: '5555'
          image: 'selenium/node-chrome:4.0.0-20211102'
          imagePullPolicy: IfNotPresent
          name: master
          ports:
            - containerPort: 5555
              protocol: TCP
  triggers:
    - type: ConfigChange
</code></pre>
<p><strong>Node Service:</strong></p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    app: selenium-node-chrome
  name: selenium-node-chrome
spec:
  ports:
    - name: node-port
      port: 5555
      protocol: TCP
      targetPort: 5555
    - name: node-port-grid
      port: 4444
      protocol: TCP
      targetPort: 4444
  selector:
    browser: chrome
  type: ClusterIP
</code></pre>
<p><strong>My Issue:</strong>
The hub and the node are starting, but the node just keeps sending the registration event and the hub is logging some infos, which i dont really understand. Please see the logs attached below.</p>
<p><strong>Node Log:</strong></p>
<pre><code>Setting up SE_NODE_GRID_URL...
Selenium Grid Node configuration: 
[events]
publish = &quot;tcp://selenium-hub:4442&quot;
subscribe = &quot;tcp://selenium-hub:4443&quot;

[server]
host = &quot;node-chrome&quot;
port = &quot;5555&quot;
[node]
session-timeout = &quot;300&quot;
override-max-sessions = false
detect-drivers = false
max-sessions = 1

[[node.driver-configuration]]
display-name = &quot;chrome&quot;
stereotype = '{&quot;browserName&quot;: &quot;chrome&quot;, &quot;browserVersion&quot;: &quot;95.0&quot;, &quot;platformName&quot;: &quot;Linux&quot;}'
max-sessions = 1

Starting Selenium Grid Node...
11:34:31.635 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
11:34:31.643 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
11:34:31.774 INFO [UnboundZmqEventBus.&lt;init&gt;] - Connecting to tcp://selenium-hub:4442 and tcp://selenium-hub:4443
11:34:31.843 INFO [UnboundZmqEventBus.&lt;init&gt;] - Sockets created
11:34:32.854 INFO [UnboundZmqEventBus.&lt;init&gt;] - Event bus ready
11:34:33.018 INFO [NodeServer.createHandlers] - Reporting self as: http://node-chrome:5555 
11:34:33.044 INFO [NodeOptions.getSessionFactories] - Detected 1 available processors
11:34:33.115 INFO [NodeOptions.report] - Adding chrome for {&quot;browserVersion&quot;: &quot;95.0&quot;,&quot;browserName&quot;: &quot;chrome&quot;,&quot;platformName&quot;: &quot;Linux&quot;,&quot;se:vncEnabled&quot;: true} 1 times
11:34:33.130 INFO [Node.&lt;init&gt;] - Binding additional locator mechanisms: name, relative, id
11:34:33.471 INFO [NodeServer$1.start] - Starting registration process for node id 2832e819-cf31-4bd9-afcc-cd2b27578d58
11:34:33.473 INFO [NodeServer.execute] - Started Selenium node 4.0.0 (revision 3a21814679): http://node-chrome:5555 
11:34:33.476 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
11:34:43.479 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
11:34:53.481 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
</code></pre>
<p><strong>Hub Log:</strong></p>
<pre><code>2021-12-07 11:14:22,663 INFO spawned: 'selenium-grid-hub' with pid 11
2021-12-07 11:14:23,664 INFO success: selenium-grid-hub entered RUNNING state, process has stayed up for &gt; than 0 seconds (startsecs)
11:14:23.953 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
11:14:23.961 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
11:14:24.136 INFO [BoundZmqEventBus.&lt;init&gt;] - XPUB binding to [binding to tcp://*:4442, advertising as tcp://XXXXXXX:4442], XSUB binding to [binding to tcp://*:4443, advertising as tcp://XXXXXX:4443]
11:14:24.246 INFO [UnboundZmqEventBus.&lt;init&gt;] - Connecting to tcp://XXXXXX:4442 and tcp://XXXXXXX:4443
11:14:24.275 INFO [UnboundZmqEventBus.&lt;init&gt;] - Sockets created
11:14:25.278 INFO [UnboundZmqEventBus.&lt;init&gt;] - Event bus ready
11:14:26.232 INFO [Hub.execute] - Started Selenium Hub 4.1.0 (revision 87802e897b): http://XXXXXXX:4444 
11:14:46.965 INFO [Node.&lt;init&gt;] - Binding additional locator mechanisms: name, relative, id
11:15:46.916 INFO [Node.&lt;init&gt;] - Binding additional locator mechanisms: relative, name, id
11:17:52.377 INFO [Node.&lt;init&gt;] - Binding additional locator mechanisms: relative, id, name
</code></pre>
<p>Can anyone tell me why the hub wont register the node?
If you need any further informations, let me know.
Thanks alot</p>

Jakob Wilmesmeier
<p>So, bit late, but still I had this same issue - the <code>docker-compose</code> example gave me selenium-hub as the host, which is correct in that scenario as it points towards the container defined by the selenium-hub service.
However, in Kubernetes, the inter-pod communication needs to go via a Service. There are multiple kinds of Service, but in order to access it from inside the cluster, it's easiest in this case to use a ClusterIP (<a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">docs here for more info</a>).</p>
<p>The way I resolved it was to have a Service for both the ports that the event bus uses:</p>
<ul>
<li>bus-publisher (port 4442)</li>
<li>bus-subscription (port 4443)</li>
</ul>
<p>In a manifest yaml, this looks like:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    app-name: selenium
  name: bus-sub
  namespace: selenium
spec:
  ports:
  - port: 4443
    protocol: TCP
    targetPort: 4443
  selector:
    app: selenium-hub
  type: ClusterIP
</code></pre>
