简体   繁体   English

如何在 nginx 入口控制器的入口规则中设置保持活动状态

[英]How to set keep alive in ingress rule for nginx inress controller

I need to set keep-alive to 0 for an application and would like to do it on ingressrule layer.我需要将应用程序的 keep-alive 设置为 0,并希望在 ingressrule 层上执行此操作。 Is that possible?那可能吗?

Is there any annotation for that?是否有任何注释?

In mandatory.yaml , you can addmandatory.yaml ,您可以添加

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.是的,Nginx 入口控制器是可能的。

But you need to use a ConfigMap for this, not an annotation.但是您需要为此使用 ConfigMap,而不是注释。

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参考资料: 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有关更多信息,请访问以下链接: Nginx Ingress ConfigMapskeep-alive

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM