ingress-nginx后端pod容器获取客服端真实ip

作者: root007 分类: kubernetes 发布时间: 2019-06-21 13:58

业务场景:
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 端口

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注