ingress-nginx后端pod容器获取客服端真实ip
业务场景:
cdn-LB-ingress-nginx
创建ingres-nginx的configmap文件
kubectl apply -f - <<EOF
apiVersion: v1
data:
compute-full-forwarded-for: "true"
forwarded-for-header: X-Forwarded-For
use-forwarded-headers: "true"
kind: ConfigMap
metadata:
labels:
app: ingress-nginx
name: nginx-configuration
namespace: ingress-nginx
EOF
compute-full-forwarded-for: "true"
forwarded-for-header: X-Forwarded-For
use-forwarded-headers: "true"
容器里面抓包验证
tcpdump -i eth0 -s 0 -w /tmp/http.cap port 端口