k8s中nginx-ingress配置总结

mtain 2022年05月26日 52次浏览

nginx-ingress配置清单

https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/configmap.md

一、显示真实IP

在k8s的nginx-ingress日志中显示访问的真实IP

1. 修改ConfigMap:nginx-configuration

compute-full-forwarded-for: "true"
forwarded-for-header: X-Forwarded-For
use-forwarded-headers: "true"

image-1653494968512

2. 重新部署nginx-ingress-controller

image-1653495052145

二、 隐藏Nginx版本

1. 修改ConfigMap:nginx-configuration

server-tokens: "false"

2. 重新部署nginx-ingress-controller