本日の課題
ingress-nginxのログではClient IPが確認できるけどバックエンドアプリの走ってるpodのログではこれがingress-nginxのIPになってる件。
ingress-nginxを見ればいい話だけど、"Nice to have" featureなので調べてと頼まれた。
Spec
AWS NLB
Kubernetes - ingress-nginx
設定
この設定がされている上で調べることに。
spec:
# this setting is to make sure the source IP address is preserved.
externalTrafficPolicy: Local
type: LoadBalancer
結局
「今現在では」できない
issues/3857で確認できます。
Proxy protocol is not available in NLBs. Please check kubernetes/kubernetes#57250
workaround
フロントエンドアプリのログでは確認できてるのでログフォーマットで見ることができる。
Resources
Kubernetes Official Document
- https://kubernetes.github.io/ingress-nginx/user-guide/miscellaneous/
- https://kubernetes.io/docs/concepts/services-networking/#proxy-protocol-support-on-aws
AWS Official Document
- https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html#proxy-protocol
- https://docs.aws.amazon.com/elasticloadbalancing/latest/network/elb-ng.pdf
- https://docs.aws.amazon.com/elasticloadbalancing/latest/network/target-group-register-targets.html#register-deregister-targets
github