Kubernetes Ingress (Specific APP) 504 Gateway Time-Out with 60 seconds Kubernetes Ingress (Specific APP) 504 Gateway Time-Out with 60 seconds kubernetes kubernetes

Kubernetes Ingress (Specific APP) 504 Gateway Time-Out with 60 seconds


What you want to achieve was mentioned in Nginx Documentation in Custom Configuration. It recommend to use ConfigMap.

$ cat configmap.yamlapiVersion: v1data:  proxy-connect-timeout: "10"  proxy-read-timeout: "120"  proxy-send-timeout: "120"kind: ConfigMapmetadata:  name: ingress-nginx-controllercurl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/docs/examples/customization/custom-configuration/configmap.yaml \    | kubectl apply -f -

If the Configmap it is updated, NGINX will be reloaded with the new configuration.

After that, in Ingress controller pod, you should see entries like:

8 controller.go:137] Configuration changes detected, backend reload required.8 controller.go:153] Backend successfully reloaded.

However, please keep in mind that higher timeout values are not recommended for Nginx. This information can be found in Nginx Ingress - proxy-connect-timeout:

Sets the timeout for establishing a connection with a proxied server. It should be noted that this timeout cannot usually exceed 75 seconds.

Additional information:

1. Sometimes, when Nginx Ingress cannot load new configuration, you can find log like below:

controller.go:149"] - Unexpected failure reloading the backend": Invalid PID number "" in "/tmp/nginx/pid"

To fix it, you just need to restart Ingress pod.

2. If you dont like default settings, you can create a config template in Go language.