Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

flask - Service+deployment on GKE hangs up after 30 minutes

I tried to look up for solutions, but I am probably not asking the correct question.

I have a service performing long running tasks deployed inside a GKE cluster (a flask app served through gunicorn). When I make a request, Postman returns a Error: socket hang up after 30 minutes. What am I not considering? Is the behaviour due to the service in front of the deployment?

My chain of services is as follows:

  • Consumer: Postman, setting for timeout=0 - i.e. infinite - and header "Connection":"keep-alive" is passed
  • loadBalancer (exposed) proxy: node+express, timeout=7200000 (ms)
  • clusterIP (internal) service: python+flask, gunicorn timeout=7200 (s)

Service is started through CMD exec gunicorn --bind 0.0.0.0:$PORT start:app --workers $NO_WORKERS --threads $NO_THREADS --timeout $TIMEOUT

The service has been deployed with the following yaml file by kubectl apply -f:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: layers-api
  labels: 
    app: layers-api
spec:
  replicas: 1
  selector:
    matchLabels:
      app: layers-api
      tier: backend
  template:
    metadata:
      labels:
        app: layers-api
        tier: backend
    spec:
      containers:
      - env:
        - name: PORT
          value: '4000'
        - name: NO_WORKERS
          value: '2'
        - name: NO_THREADS
          value: '2'
        - name: TIMEOUT
          value: '7200'
        # ...other env vars... 
        name: layers-api
        image: [DOMAIN]/[PROJECT]/[IMAGE]
        imagePullPolicy: Always
        ports:
          - containerPort: 4000
        readinessProbe:
          httpGet:
            path: /api/v1/healthz
            port: 4000
          initialDelaySeconds: 30
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /api/v1/healthz
            port: 4000
---
apiVersion: v1 
kind: Service
metadata:
  name: layers-api
  labels:
    app: layers-api
    tier: backend
spec:
  selector:
    app: layers-api
    tier: backend
  ports:
  - port: 80
    targetPort: 4000
    protocol: TCP
    name: http
  - port: 443
    targetPort: 4000
    protocol: TCP
    name: https
---

Thank you for spending your time to help.

C

EDIT: this the log from the proxy server. Moreover, I use this proxy for another routing (to a managed cloud run service - beta timeout of 3600 seconds) and this does not hang up after 30 minutes).

question from:https://stackoverflow.com/questions/65928332/servicedeployment-on-gke-hangs-up-after-30-minutes

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

Just Browsing Browsing

[3] html - How to create even cell spacing within a

1.4m articles

1.4m replys

5 comments

57.0k users

...