<p>I have setup a web application in kubernetes with a nginx-ingress controller. I am able to access my application over the Nginx ingress controller public IP.</p>

<p>For requests which are taking more than 1 min, we are getting gateway connection timeout error (504). I've checked the Nginx ingress controller configuration by connecting to the pod and it has connection_timeout value is 60s. (root cause of the issue)</p>

<p>I have tried changing the parameters to higher values and its work fine for long requests, though Nginx ingress controller configuration got reloaded to default after some time. </p>

<p>How can we change/persist the Nginx ingress controller configuration parameters?</p>

<p>Appreciate any help. Thanks in advance.</p>

<p>The nginx ingress controller is customizable via a configmap.</p>

<p>You can achieve this by passing the argument <code>--configmap</code> to the ingress controller. Source: <a href="https://github.com/kubernetes/ingress/tree/master/controllers/nginx#command-line-arguments" rel="nofollow noreferrer">https://github.com/kubernetes/ingress/tree/master/controllers/nginx#command-line-arguments</a></p>

<p>In the <code>kube-system</code> namespace, create a configmap, give it name like <code>nginx-load-balancer-conf</code> and then edit your ingress controller's replication controller or daemonset and add the <code>--configmap=nginx-load-balancer-conf</code> argument.</p>

<p>Here's an example of what that configmap could look like:</p>

<pre><code>apiVersion: v1
data:
  proxy-connect-timeout: "10"
  proxy-read-timeout: "120"
  proxy-send-timeout: "120"
kind: ConfigMap
metadata:
  name: nginx-load-balancer-conf
</code></pre>

<p>And here's how you create it, if you were to save the above to a file called <code>nginx-load-balancer-conf.yaml</code></p>

<pre><code>kubectl create -f nginx-load-balancer-conf.yaml
</code></pre>

<p><strong>EDIT</strong></p>

<p>The documentation has moved, the valid links to these documents are now here:</p>

<p><a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#configuration-options" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#configuration-options</a></p>
