<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><strong>UPDATE</strong> I noticed now that you found alone the issue, my bad.</p>

<p>I believe that as Ami Hollander is right, it is an issue with the label selector, but I would like to explain you why. </p>

<p>Consider that each time you create a <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">service</a> with a selector, an endpoint resource is created as well, it is populated with all the address of the nodes having a pod matching the label, you can add as well manually any IP or Domain to point to external resources.</p>

<p>Kubernetes services can be exposed on externalIPs that routes to one or more cluster nodes. Traffic that ingresses into the cluster with the external IP (as destination IP), on the service port, will be routed to one of the service endpoints.</p>

<p>Therefore, as they pointed you out, your selector was not matching any pod and the endpoint resource likely does not contain any backend and so any way route the request. You can double check it running:</p>

<pre><code>$ kubectl get endpoints
$ Kubectl describe endpoints endpointname
</code></pre>

<p>It can be misleading because on the other hand if you run</p>

<pre><code>$ kubectl get services
</code></pre>

<p>you will notice that the service has been correctly created showing a private and a public IP that will be simply a dead end.</p>

<ul>
<li>You were able to see it correctly because everything was working, but the request was not routed in the right way.</li>
</ul>
