kubernetes nginx入口插座.io400连续错误

2024-10-02 00:36:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我想揭露插座.iotermjs使用kubernetes nginx-ingres,下面是我对YAML文件的定义。这是python烧瓶应用程序

apiVersion: v1
kind: Service
metadata:
  name: ejllvrteiafpdiaqjflc
  labels:
    name: ejllvrteiafpdiaqjflc
spec:
  sessionAffinity: "ClientIP"
  ports:
    - port: 5000
      targetPort: 5000
      protocol: TCP
  selector:
    app: ejllvrteiafpdiaqjflc
  type: ClusterIP
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: aaoxmmoyjsnditztroam
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.org/websocket-services: "ejllvrteiafpdiaqjflc"
    #nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/websocket-services: 'ejllvrteiafpdiaqjflc'
    nginx.ingress.kubernetes.io/force-ssl-redirect: 'false'
    ingress.kubernetes.io/ssl-redirect: "false"
    nginx.org/hsts-include-subdomains: "0cloud0.com"
    nginx.org/hsts: "false"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "1800"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "1800" 
    #nginx.org/hsts-max-age: 2592000
spec:
  rules:
  - host: python3.minikube
    http:
      paths:
      - path: /
        backend:
          serviceName: ejllvrteiafpdiaqjflc
          servicePort: 5000
      #- path: /socket.io
      #  backend:
      #    serviceName: ejllvrteiafpdiaqjflc
      #    servicePort: 5000
  tls:
  - secretName: 0cloud0-wildcard-certs
    hosts:
    - python3.minikube

这是我收到的错误信息

enter image description here

我的web浏览器控制台上连续出现400个错误,尽管提供了idea页面

^{pr2}$

服务没有问题

# kubectl get svc  -n playground 
NAME                   TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
ejllvrteiafpdiaqjflc   ClusterIP   10.104.19.247   <none>        5000/TCP   12m

是否需要添加其他nginx入口配置,请帮助

当我在docker上部署相同的配置时没有问题。这个插座.io就像一个咒语,当我把它带到kubernetes ingress时,它失败了,错误为400

docker run -it -p 5000:5000 -v $PWD:/opt/ myimage

这是现场演示

处理不安全的通道http://0cloud0.com/playground

nginx入口定义

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
    nginx.ingress.kubernetes.io/rewrite-target: /
  creationTimestamp: "2019-08-24T06:58:10Z"
  generation: 1
  name: ikqyvhiapqotawmicggv
  namespace: default
  resourceVersion: "2443222"
  selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/ikqyvhiapqotawmicggv
  uid: 09ec9f79-6c30-408e-b53e-27ea9accdc89
spec:
  rules:
  - host: ikqyvhiapqotawmicggv.0cloud0.com
    http:
      paths:
      - backend:
          serviceName: ikqyvhiapqotawmicggv
          servicePort: 5000
        path: /
status:
  loadBalancer:
    ingress:
    - {}

不在安全后端工作https://0cloud0.com/playground

以及入口定义

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
    nginx.ingress.kubernetes.io/rewrite-target: /
  creationTimestamp: "2019-08-24T06:58:33Z"
  generation: 2
  name: default
  namespace: playground
  resourceVersion: "2445448"
  selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/gyybtfotzioqqettmgdd
  uid: 29c8b4d8-f37d-4116-a0f0-4c52ade073af
spec:
  rules:
  - host: gyybtfotzioqqettmgdd.0cloud0.com
    http:
      paths:
      - backend:
          serviceName: gyybtfotzioqqettmgdd
          servicePort: 5000
        path: /
  tls:
  - hosts:
    - gyybtfotzioqqettmgdd.0cloud0.com
    secretName: certs
status:
  loadBalancer:
    ingress:
    - {}

这是nginx调试日志

2019/08/25 04:20:17 [debug] 42#42: *407 epoll add connection: fd:50 ev:80002005
2019/08/25 04:20:17 [debug] 42#42: *407 connect to 192.168.155.213:5000, fd:50 #2674
2019/08/25 04:20:17 [debug] 42#42: *407 http upstream connect: -2
2019/08/25 04:20:17 [debug] 42#42: *407 posix_memalign: 000055C3DC987410:128 @16
2019/08/25 04:20:17 [debug] 42#42: *407 event timer add: 50: 5000:1617484036
2019/08/25 04:20:17 [debug] 42#42: *407 http finalize request: -4, "/socket.io/?EIO=3&transport=polling&t=Mp70Dqy.0&sid=693a8ca68d8a4fdba627b4fe9b3e6ee6" a:1, c:2
2019/08/25 04:20:17 [debug] 42#42: *407 http request count:2 blk:0
2019/08/25 04:20:17 [debug] 42#42: *407 http2 frame complete pos:000055C3DCA6B1B2 end:000055C3DCA6B1C4
2019/08/25 04:20:17 [debug] 42#42: *407 http2 frame type:0 f:1 l:9 sid:401
2019/08/25 04:20:17 [debug] 42#42: *407 http2 DATA frame
2019/08/25 04:20:17 [debug] 42#42: *407 event timer del: 3: 1617539036
2019/08/25 04:20:17 [debug] 42#42: *407 http body new buf t:1 f:0 000055C3DC9740E0, pos 000055C3DC9740E0, size: 9 file: 0, size: 0
2019/08/25 04:20:17 [debug] 42#42: *407 http init upstream, client timer: 0
2019/08/25 04:20:17 [debug] 42#42: *407 http map started
2019/08/25 04:20:17 [debug] 42#42: *407 http map: "" ""
2019/08/25 04:20:17 [debug] 42#42: *407 http map started
2019/08/25 04:20:17 [debug] 42#42: *407 http script var: "6ed5f2d5ee580af749a3ee12955a32c6"
2019/08/25 04:20:17 [debug] 42#42: *407 http map: "" "6ed5f2d5ee580af749a3ee12955a32c6"
2019/08/25 04:20:17 [debug] 42#42: *407 http map started
2019/08/25 04:20:17 [debug] 42#42: *407 http script var: "172.20.240.119"
2019/08/25 04:20:17 [debug] 42#42: *407 http map: "" "172.20.240.119"
2019/08/25 04:20:17 [debug] 42#42: *407 http script copy: "Host"
2019/08/25 04:20:17 [debug] 42#42: *407 http script var: "gyybtfotzioqqettmgdd.0cloud0.com"
2019/08/25 04:20:17 [debug] 42#42: *407 http script copy: ""
2019/08/25 04:20:17 [debug] 42#42: *407 http script copy: ""
2019/08/25 04:20:17 [debug] 42#42: *407 http script copy: "X-Request-ID"
2019/08/25 04:20:17 [debug] 42#42: *407 http script var: "6ed5f2d5ee580af749a3ee12955a32c6"
2019/08/25 04:20:17 [debug] 42#42: *407 http script copy: "X-Real-IP"
2019/08/25 04:20:17 [debug] 42#42: *407 http script var: "172.20.240.119"
2019/08/25 04:20:17 [debug] 42#42: *407 http script copy: "X-Forwarded-For"
2019/08/25 04:20:17 [debug] 42#42: *407 http script var: "172.20.240.119"
2019/08/25 04:20:17 [debug] 42#42: *407 http script copy: "X-Forwarded-Host"
2019/08/25 04:20:17 [debug] 42#42: *407 http script var: "gyybtfotzioqqettmgdd.0cloud0.com"
2019/08/25 04:20:17 [debug] 42#42: *407 http script copy: "X-Forwarded-Port"
2019/08/25 04:20:17 [debug] 42#42: *407 http script var: "443"
2019/08/25 04:20:17 [debug] 42#42: *407 http script copy: "X-Forwarded-Proto"
2019/08/25 04:20:17 [debug] 42#42: *407 http script var: "https"
2019/08/25 04:20:17 [debug] 42#42: *407 http script copy: "X-Original-URI"
2019/08/25 04:20:17 [debug] 42#42: *407 http script var: "/socket.io/?EIO=3&transport=polling&t=Mp70Dqy&sid=693a8ca68d8a4fdba627b4fe9b3e6ee6"
2019/08/25 04:20:17 [debug] 42#42: *407 http script copy: "X-Scheme"
2019/08/25 04:20:17 [debug] 42#42: *407 http script var: "https"
2019/08/25 04:20:17 [debug] 42#42: *407 http script copy: ""
2019/08/25 04:20:17 [debug] 42#42: *407 http script copy: "Content-Length"
2019/08/25 04:20:17 [debug] 42#42: *407 http script var: "9"
2019/08/25 04:20:17 [debug] 42#42: *407 http script copy: ""
2019/08/25 04:20:17 [debug] 42#42: *407 http proxy header: "accept: */*"
2019/08/25 04:20:17 [debug] 42#42: *407 http proxy header: "content-type: text/plain;charset=UTF-8"
2019/08/25 04:20:17 [debug] 42#42: *407 http proxy header: "origin: https://gyybtfotzioqqettmgdd.0cloud0.com"
2019/08/25 04:20:17 [debug] 42#42: *407 http proxy header: "accept-language: en-us"
2019/08/25 04:20:17 [debug] 42#42: *407 http proxy header: "user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Safari/605.1.15"
2019/08/25 04:20:17 [debug] 42#42: *407 http proxy header: "referer: https://gyybtfotzioqqettmgdd.0cloud0.com/"
2019/08/25 04:20:17 [debug] 42#42: *407 http proxy header: "accept-encoding: gzip, deflate"
2019/08/25 04:20:17 [debug] 42#42: *407 http proxy header: "cookie: io=693a8ca68d8a4fdba627b4fe9b3e6ee6; _ga=GA1.2.1800403221.1565147284; __cfduid=d9af956869a1d3006e31a45957fdb83971566291845"
2019/08/25 04:20:17 [debug] 42#42: *407 http proxy header:
"POST /socket.io/?EIO=3&transport=polling&t=Mp70Dqy&sid=693a8ca68d8a4fdba627b4fe9b3e6ee6 HTTP/1.1
Host: gyybtfotzioqqettmgdd.0cloud0.com
X-Request-ID: 6ed5f2d5ee580af749a3ee12955a32c6
X-Real-IP: 172.20.240.119
X-Forwarded-For: 172.20.240.119
X-Forwarded-Host: gyybtfotzioqqettmgdd.0cloud0.com
X-Forwarded-Port: 443
X-Forwarded-Proto: https
X-Original-URI: /socket.io/?EIO=3&transport=polling&t=Mp70Dqy&sid=693a8ca68d8a4fdba627b4fe9b3e6ee6
X-Scheme: https
Content-Length: 9
accept: */*
content-type: text/plain;charset=UTF-8
origin: https://gyybtfotzioqqettmgdd.0cloud0.com
accept-language: en-us
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Safari/605.1.15
referer: https://gyybtfotzioqqettmgdd.0cloud0.com/
accept-encoding: gzip, deflate
cookie: io=693a8ca68d8a4fdba627b4fe9b3e6ee6; _ga=GA1.2.1800403221.1565147284; __cfduid=d9af956869a1d3006e31a45957fdb83971566291845

"
2019/08/25 04:20:17 [debug] 42#42: *407 http cleanup add: 000055C3DCACC9C0
2019/08/25 04:20:17 [debug] 42#42: *407 init keepalive peer
2019/08/25 04:20:17 [debug] 42#42: *407 get keepalive peer
2019/08/25 04:20:17 [debug] 42#42: *407 lua balancer peer, tries: 1
2019/08/25 04:20:17 [debug] 42#42: *407 lua reset ctx
2019/08/25 04:20:17 [debug] 42#42: *407 looking up Lua code cache with key 'balancer_by_luanhli_0f29762dfd828b8baa4d895affbc4b90'
2019/08/25 04:20:17 [debug] 42#42: *407 stream socket 51
2019/08/25 04:20:17 [debug] 42#42: *407 epoll add connection: fd:51 ev:80002005
2019/08/25 04:20:17 [debug] 42#42: *407 connect to 192.168.155.213:5000, fd:51 #2675
2019/08/25 04:20:17 [debug] 42#42: *407 http upstream connect: -2
2019/08/25 04:20:17 [debug] 42#42: *407 posix_memalign: 000055C3DC9635C0:128 @16
2019/08/25 04:20:17 [debug] 42#42: *407 event timer add: 51: 5000:1617484036
2019/08/25 04:20:17 [debug] 42#42: *407 http2 frame complete pos:000055C3DCA6B1C4 end:000055C3DCA6B1C4
2019/08/25 04:20:17 [debug] 42#42: *407 http2 frame out: 000055C3DCA35620 sid:0 bl:0 len:4
2019/08/25 04:20:17 [debug] 42#42: *407 SSL buf copy: 13
2019/08/25 04:20:17 [debug] 42#42: *407 SSL to write: 13
2019/08/25 04:20:17 [debug] 42#42: *407 SSL_write: 13
2019/08/25 04:20:17 [debug] 42#42: *407 http2 frame sent: 000055C3DCA35620 sid:0 bl:0 len:4
2019/08/25 04:20:17 [debug] 42#42: *407 http upstream request: "/socket.io/?EIO=3&transport=polling&t=Mp70Dqy.0&sid=693a8ca68d8a4fdba627b4fe9b3e6ee6"
2019/08/25 04:20:17 [debug] 42#42: *407 http upstream send request handler
2019/08/25 04:20:17 [debug] 42#42: *407 http upstream send request
2019/08/25 04:20:17 [debug] 42#42: *407 http upstream send request body
2019/08/25 04:20:17 [debug] 42#42: *407 chain writer buf fl:1 s:855
2019/08/25 04:20:17 [debug] 42#42: *407 chain writer in: 000055C3DCAAEB20
2019/08/25 04:20:17 [debug] 42#42: *407 writev: 855 of 855
2019/08/25 04:20:17 [debug] 42#42: *407 chain writer out: 0000000000000000
2019/08/25 04:20:17 [debug] 42#42: *407 event timer del: 50: 1617484036
2019/08/25 04:20:17 [debug] 42#42: *407 event timer add: 50: 60000:1617539036
2019/08/25 04:20:17 [debug] 42#42: *407 http upstream request: "/socket.io/?EIO=3&transport=polling&t=Mp70Dqy&sid=693a8ca68d8a4fdba627b4fe9b3e6ee6"
2019/08/25 04:20:17 [debug] 42#42: *407 http upstream send request handler
2019/08/25 04:20:17 [debug] 42#42: *407 http upstream send request
2019/08/25 04:20:17 [debug] 42#42: *407 http upstream send request body
2019/08/25 04:20:17 [debug] 42#42: *407 chain writer buf fl:0 s:961
2019/08/25 04:20:17 [debug] 42#42: *407 chain writer buf fl:1 s:9
2019/08/25 04:20:17 [debug] 42#42: *407 chain writer in: 000055C3DCACCAF8
2019/08/25 04:20:17 [debug] 42#42: *407 writev: 970 of 970
2019/08/25 04:20:17 [debug] 42#42: *407 chain writer out: 0000000000000000
2019/08/25 04:20:17 [debug] 42#42: *407 event timer del: 51: 1617484036
2019/08/25 04:20:17 [debug] 42#42: *407 event timer add: 51: 60000:1617539036
2019/08/25 04:20:17 [debug] 42#42: *407 http upstream request: "/socket.io/?EIO=3&transport=polling&t=Mp70Dqy&sid=693a8ca68d8a4fdba627b4fe9b3e6ee6"
2019/08/25 04:20:17 [debug] 42#42: *407 http upstream process header
2019/08/25 04:20:17 [debug] 42#42: *407 malloc: 000055C3DCAAF100:4096
2019/08/25 04:20:17 [debug] 42#42: *407 recv: eof:1, avail:1
2019/08/25 04:20:17 [debug] 42#42: *407 recv: fd:51 159 of 4096
2019/08/25 04:20:17 [debug] 42#42: *407 http proxy status 400 "400 BAD REQUEST"
2019/08/25 04:20:17 [debug] 42#42: *407 http proxy header: "Content-Type: text/plain"
2019/08/25 04:20:17 [debug] 42#42: *407 http proxy header: "Connection: close"
2019/08/25 04:20:17 [debug] 42#42: *407 http proxy header: "Server: Werkzeug/0.15.5 Python/3.7.3"
2019/08/25 04:20:17 [debug] 42#42: *407 http proxy header: "Date: Sun, 25 Aug 2019 04:20:17 GMT"
2019/08/25 04:20:17 [debug] 42#42: *407 http proxy header done

Tags: iodebugcomhttprequestvarscriptnginx

热门问题