My question is a duplicate of this question: nginx ingress controller forward source ip
Though the accepted answer there is a Helm repository that is now deprecated and does not solve the problem of forwarding the user IP.
I followed the official Oracle Documentation and by checking the file deploy.yaml
one can see that the policy is already set to Local
by default:
apiVersion: v1
kind: Service
metadata:
annotations:
labels:
helm.sh/chart: ingress-nginx-3.23.0
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/version: 0.44.0
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: controller
name: ingress-nginx-controller
namespace: ingress-nginx
spec:
type: LoadBalancer
externalTrafficPolicy: Local
ports:
- name: http
port: 80
protocol: TCP
targetPort: http
- name: https
port: 443
protocol: TCP
targetPort: https
Though when checking the logs with kubectl logs POD_NAME
, I always get a 10.0.20.X
visiting the endpoint, and never my real IP. Am I mistaken somewhere? How do I forward the user IP?