<p>I have a Python controller which uses <code>scrapy-splash</code> lib that sends <code>SplashRequest</code> to a Splash service.</p>

<p>Locally, I run both, the controller and the splash service in a two different Dockers. </p>

<p><code>yield SplashRequest(url=response.url, callback=parse, splash_url=&lt;URL&gt; endpoint='execute', args=&lt;SPLASH_ARGS&gt;)</code></p>

<p>When I send the request locally with <code>splash_url="http://127.0.0.1:8050</code>, everything works fine.</p>

<p>Now, I wanted to have a Kubernetes deployment with Splash and to process the splash request on the cloud. I have created Splash Deployment and a Service with <code>type=LoadBalancer</code> on Google Cloud Kubernetes.</p>

<p>And sending the splash request to the <code>External Ip</code> of the splash service.</p>

<p>But splash doesn't receive any request... and in the python script I get</p>

<blockquote>
  <p>twisted.python.failure.Failure twisted.internet.error.TCPTimedOutError: TCP connection timed out: 60: Operation timed out.</p>
</blockquote>

<p>It worked in the past while using  <code>Internal endpoint</code> of the pod, but I started to get <code>Missing schema</code> exception cause I didn't used <code>http://</code> in the url.</p>

<ul>
<li>splash docker image scrapinghub/splash:3.2</li>
<li>Kubernetes version 1.7, (tried also on 1.9)</li>
</ul>

<p>splash-deployment.yaml</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    app: my-app
  name: splash
  namespace: ns-app
spec:
  replicas: 1
  strategy: {}
  template:
    metadata:
      labels:
        app: splash
    spec:
      containers:
      - image: scrapinghub/splash:3.2
        name: splash
        ports:
        - containerPort: 8050
        resources: {}
      restartPolicy: Always
status: {}
</code></pre>

<p>splash-service.yaml</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    app: app
  name: splash
  namespace: ns-app
spec:
  type: LoadBalancer
  ports:
  - name: "8050"
    port: 8050
    targetPort: 8050
    protocol: TCP
  selector:
    app: app
status:
  loadBalancer: {}
</code></pre>

<p><strong>UPDATE</strong>
I noticed that locally when I get into <code>http://localhost:8050/</code> I see Splash UI, while entering to the via Kubernetes IP I get </p>

<blockquote>
  <p>refused to connect</p>
</blockquote>

<p>How to solve it??
Thank you</p>

<p>The problem is that <code>splash-service.yaml</code> selector is wrong.. it should point to the Deployment name.</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    app: app
  name: splash
  namespace: ns-app
spec:
  type: LoadBalancer
  ports:
  - name: "8050"
    port: 8050
    targetPort: 8050
    protocol: TCP
  selector:
    app: splash
status:
  loadBalancer: {}
</code></pre>
