简体   繁体   中英

Kubernetes getting IP from Ingress (Oracle Cloud)

My question is a duplicate of this question: nginx ingress controller forward source ip

Though the accepted answer there is aHelm 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?

I have seen similar issues (not being able to see Real IP) with launching a Loadbalancer service when the annotation service.beta.kubernetes.io/oci-load-balancer-backend-protocol: is not set to HTTP.

I suggest you try launching the Ingress-Controller service with this annotation and see if it makes any difference.

我面临同样的问题,有解决方案吗?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM