I need to set keep-alive to 0 for an application and would like to do it on ingressrule layer. Is that possible?
Is there any annotation for that?
In mandatory.yaml
, you can add
data: keep-alive-requests: "1000000"
kind: ConfigMap
apiVersion: v1
metadata:
name: nginx-configuration
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
data:
proxy-connect-timeout: "10s"
proxy-read-timeout: "10s"
client-max-body-size: "2m"
keep-alive-requests: "1000000"
upstream-keepalive-requests: "1000000"
Yes, it is possible for Nginx Ingress Controller.
But you need to use a ConfigMap for this, not an annotation.
keep-alive
Sets the time during which a keep-alive client connection will stay open on the server side. The zero value disables keep-alive client connections.
References: http://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_timeout
Here is the example:
apiVersion: v1
data:
keep-alive: 0
kind: ConfigMap
metadata:
name: nginx-configuration
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
For more information, visit the following links: Nginx Ingress ConfigMaps and keep-alive