kubernetes 클러스터 외부의 사용자 지정 엔드포인트로 라우팅되는 수신이 있습니다. 서비스는 포트 8006의 HTTPS에서만 수신 대기합니다.
apiVersion: v1
kind: Service
metadata:
name: pve
spec:
ports:
- protocol: TCP
port: 8006
---
apiVersion: v1
kind: Endpoints
metadata:
name: pve
subsets:
- addresses:
- ip: 10.0.1.2
ports:
- port: 8006
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: pve
annotations:
kubernetes.io/ingress.class: "nginx"
cert-manager.io/cluster-issuer: "letsencrypt-prod"
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
nginx.ingress.kubernetes.io/auth-tls-verify-client: "off"
nginx.ingress.kubernetes.io/whitelist-source-range: "10.0.0.0/16"
spec:
tls:
- hosts:
- pve.example.com
secretName: pve-tls
rules:
- host: pve.example.com
http:
paths:
- backend:
serviceName: pve
servicePort: 8006
path: /
nginx 포드에 오류가 발생합니다.
10.0.0.25 - - [28/Aug/2020:01:17:58 +0000] "GET / HTTP/1.1" 502 157 "-" "Mozilla/5.0(Windows NT 10.0; Win64; x64; rv:79.0) Gecko /20100101 Firefox/79.0" "-"
2020/08/28 01:17:58 [오류] 2609#2609: *569 업스트림에서 응답 헤더를 읽는 동안 업스트림 연결이 조기에 종료됨, 클라이언트: 10.0.0.25, 서버: pve.example.com, 요청: "GET / HTTP /1.1", 업스트림: "http://10.0.1.2:8006/", 호스트: "pve.example.com"
편집하다
프록시 프로토콜을 제거한 후 오류가 발생합니다.
10.0.10.1 - - [28/Aug/2020:02:19:18 +0000] "GET / HTTP/1.1" 400 59 "-" "curl/7.58.0" "-"
2020/08/28 02:19:26 [오류] 2504#2504: *521 업스트림에서 응답 헤더를 읽는 동안 업스트림 연결이 조기에 종료됨, 클라이언트: 10.0.10.1, 서버: pve.example.com, 요청: "GET / HTTP /1.1", 업스트림: "http://10.0.1.2:8006/", 호스트: "pve.example.com"
10.0.10.1 - - [28/Aug/2020:02:19:26 +0000] "GET / HTTP/1.1" 502 157 "-" "curl/7.58.0" "-"
그리고 관련이 있는 경우 helm char을 통해 배포된 내 nginx 구성nginx-stable/nginx-ingress
## nginx configuration
## Ref: https://github.com/kubernetes/ingress/blob/master/controllers/nginx/configuration.md
##
controller:
config:
entries:
hsts-include-subdomains: "false"
ssl-ciphers: "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4"
ssl-protocols: "TLSv1.1 TLSv1.2"
ingressClass: nginx
service:
externalTrafficPolicy: Local
annotations:
metallb.universe.tf/address-pool: default
defaultBackend:
enabled: true
tcp:
22: "gitlab/gitlab-gitlab-shell:22"
답변1
이 주석이 문제의 원인일 수 있습니다.
nginx.ingress.kubernetes.io/use-proxy-protocol: "true"
그만큼문서상태:
HAProxy 및 Amazon Elastic Load Balancer(ELB)와 같은 프록시 서버와 로드 밸런서를 통해 전달된 클라이언트 연결(실제 IP 주소) 정보를 수신하기 위해 PROXY 프로토콜을 활성화하거나 비활성화합니다.
PROXY 프로토콜을 사용하여 연결을 전달하는 Ingress 앞에 로드 밸런서가 없는 경우 이는 원하는 것이 아니며 이 주석이 없어야 합니다(또는 있어야 합니다 "false"
).
답변2
이것은 커뮤니티 위키 답변입니다. 자유롭게 확장해 보세요.
표시되는 오류는 upstream prematurely closed connection while reading response header from upstream
Nginx에서 발생하며 "업스트림"에 의해 연결이 닫혔음을 의미합니다.
필요한 세부 정보 없이 이 문제의 정확한 원인이 무엇인지 말하기는 어렵지만 상관없이 할 수 있는 일은 다음에 따라 시간 초과 값을 늘리는 것입니다.이 문서, 구체적으로:
proxy_read_timeout
proxy_connect_timeout
사용 사례에 관계없이 "업스트림"에서 코드/구성을 조정할 수도 있습니다.