【发布时间】:2018-03-08 08:34:14
【问题描述】:
我有一个 Python 控制器,它使用 scrapy-splash 库将 SplashRequest 发送到 Splash 服务。
在本地,我在两个不同的 Docker 中同时运行控制器和启动服务。
yield SplashRequest(url=response.url, callback=parse, splash_url=<URL> endpoint='execute', args=<SPLASH_ARGS>)
当我使用 splash_url="http://127.0.0.1:8050 在本地发送请求时,一切正常。
现在,我想使用 Splash 部署 Kubernetes,并在云上处理启动请求。我在 Google Cloud Kubernetes 上使用type=LoadBalancer 创建了 Splash 部署和服务。
并将启动请求发送到启动服务的External Ip。
但是 splash 没有收到任何请求...并且在我得到的 python 脚本中
twisted.python.failure.Failure twisted.internet.error.TCPTimedOutError:TCP 连接超时:60:操作超时。
过去在使用 pod 的 Internal endpoint 时它可以工作,但我开始收到 Missing schema 异常,因为我没有在 url 中使用 http://。
- splash docker image scrapinghub/splash:3.2
- Kubernetes 版本 1.7,(也在 1.9 上尝试过)
splash-deployment.yaml
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: {}
splash-service.yaml
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: {}
更新
我注意到,当我在本地进入 http://localhost:8050/ 时,我看到了 Splash UI,而在通过 Kubernetes IP 进入时,我得到了
拒绝连接
怎么解决?? 谢谢
【问题讨论】:
标签: docker kubernetes splash-screen scrapy-splash