優化nginx-ingress-controller性能


1.首先優化ingress-controller

通過 Helm 安裝 Nginx Ingress 的默認關聯配置映射實例名稱為 nginx-ingress-controller,用戶可以通過修改資源對象 Deployment/DaemonSet 實例 nginx-ingress-controller 中的參數 --configmap 自定義關聯配置映射實例的名稱。

於是參考nginx-ingress-controller的ConfigMap配置方法,這里配置了下:

$ kubectl -n kube-system edit configmap nginx-configuration
...
apiVersion: v1
kind: ConfigMap
data:
  allow-backend-server-header: 'true'
  enable-underscores-in-headers: 'true'
  generate-request-id: 'true'
  ignore-invalid-headers: 'true'
  keep-alive: '75'
  keep-alive-requests: '1000'
  max-worker-connections: '65536'
  proxy-body-size: 80m
  proxy-connect-timeout: '10'
  reuse-port: 'true'
  server-tokens: 'false'
  ssl-redirect: 'false'
  upstream-keepalive-connections: '1000'
  upstream-keepalive-requests: '10000'
  upstream-keepalive-timeout: '60'
  worker-cpu-affinity: auto

 

2.參考ingress的Annotations配置方法,優化具體deployment.yml里的ingress 配置

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "20"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "20"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "20"
    nginx.ingress.kubernetes.io/connection-proxy-header: "keep-alive"
    nginx.ingress.kubernetes.io/proxy-http-version: "1.1"
    nginx.ingress.kubernetes.io/proxy-body-size: 80m

 

參考:

https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/

http://www.weixueyuan.net/a/877.html

https://www.iyunw.cn/archives/ingress-nginx-keng-dian-chi-xu-geng-xin/

https://cloud.tencent.com/developer/article/1537695


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM