我尝试使用代理协议在Google容器上设置nginx入口(节点端口),以便可以将真实IP转发到后端服务,但最终报头损坏。
2017/02/05 13:48:52 [error] 18#18: *2 broken header: "?????~??]H?k??m[|????I??iv.?{y??Z ??v??q???2Iu4P?z;? o$?s????"???+?/?,?0??????/" while reading PROXY protocol, client: 10.50.0.1, server: 0.0.0.0:443
Run Code Online (Sandbox Code Playgroud)
如果没有代理协议,一切都会很好。根据https://blog.mythic-beasts.com/2016/05/09/proxy-protocol-nginx-broken-header/,这是由于使用了v2协议(二进制),但是nginx只能说v1 。有什么建议吗?
我正在尝试使用 traefik 获取 Kubernetes pod 的真实源 IP 地址。我正在使用启用了代理协议的数字海洋负载均衡器。我还配置了 K8s 服务 yaml,将外部流量策略设置为本地。
从我的 K8s 中的 Traefik Ingress configmap 中摘录。我已经编辑了我的实际 IP,但我使用我的负载均衡器 IP 和 Kubernetes 工作节点专用 IP
[entryPoints]
[entryPoints.http]
address = ":80"
compress = true
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
compress = true
[entryPoints.https.tls]
[[entryPoints.https.tls.certificates]]
CertFile = "/ssl/client_co.crt"
KeyFile = "/ssl/tls.key"
[entryPoints.https.proxyProtocol]
trustedIPs = ["Load Balancer IP, Kubernetes Worker Node IPs"]
[entryPoints.https.redirect]
regex = "^https://(?:www\\.)(.*)"
replacement = "https://$1"
permanent = true
Run Code Online (Sandbox Code Playgroud)
这是部署文件服务yaml的一部分
kind: Service
apiVersion: v1
metadata:
name: traefik-ingress-service …Run Code Online (Sandbox Code Playgroud)