Получение "Игнорирование соединения EPIPE" при GET-запросе в Gunicorn. Django +NGINX + Gunicorn + INGRESS
Я пытаюсь перенести свое приложение на kubernetes
с хоста docker
. Приложение построено с использованием Django
, Nginx
, Gunicorn
.
Приложение отлично загружается в k8s. Контейнер может подключиться к базе данных (проверено через telnet).
Приложение может успешно выполнять несколько GET-запросов, но один GET-запрос выдает следующую ошибку:
В журналах ошибок Gunicorn я получаю следующую ошибку:
*[2022-07-13 08:08:41 +0000] [107] [DEBUG] GET /MyApp/URL/*
*[2022-07-13 08:21:51 +0000] [105] [DEBUG] Ignoring connection epipe*
*[2022-07-13 08:37:36 +0000] [107] [DEBUG] Ignoring connection epipe*
Как решить эту проблему?
Добавление всех конфигураций, которые я сделал на уровне Ingress, Nginx
, Gunicorn
:
Ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: app-name
namespace: {{ .Release.Namespace }}
annotations:
nginx.ingress.kubernetes.io/proxy-connect-timeout: "1000"
nginx.ingress.kubernetes.io/proxy-read-timeout: "1000"
nginx.ingress.kubernetes.io/proxy-send-timeout: "1000"
nginx.ingress.kubernetes.io/allow-backend-server-header: "true"
spec:
rules:
- host: {{ .Values.ingress_hostname }}
http:
paths:
- backend:
service:
name: app-service
port:
number: 443
path: /
pathType: ImplementationSpecific
tls:
- hosts:
- {{ .Values.ingress_hostname }}
secretName: {{ .Values.tls.name }}
service.yaml
apiVersion: v1
kind: Service
metadata:
name: app-service
namespace: {{ .Release.Namespace }}
labels:
{{- include "app-name.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- name: https
protocol: TCP
targetPort: 443
port: 443
selector:
{{- include "app-name.selectorLabels" . | nindent 4 }}
Nginxfile
server {
server_name localhost;
listen 443;
proxy_connect_timeout 1200s;
proxy_send_timeout 1200s;
proxy_read_timeout 1200s;
send_timeout 1200s;
location /static/ {
autoindex on;
alias /work/static/;
}
location / {
client_max_body_size 1024M;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://0.0.0.0:8001;
}
}
Команда Гуникорн:
gunicorn app-name.wsgi:application \
--name app-name \
--bind=0.0.0.0:8001 \
--reload \
--workers 25 \
--threads 3 \
--timeout 1200 \
--graceful-timeout 1200 \
--access-logfile /var/log/app-name.log \
--access-logformat="{<log_formate>}" \
--log-level debug \
--error-logfile /var/log/log_file_name.log &