Saving a Remote IP Client Using Ingress

My goal is to make my web application (deployed on a Kubernetes 1.4 cluster) look at the IP address of the client who originally made the HTTP request. Since I plan to run the application on a bare group, the GCE and service annotations service.alpha.kubernetes.io/external-traffic: OnlyLocalintroduced in 1.4 are not applicable to me.

Looking for alternatives, I found this question that suggests setting Ingress to achieve my goal. So, I installed Ingress and NginX Ingress Controller . The deployment went smoothly and I was able to connect to my web application through Ingress Address and port 80. However, in the logs I still see the range of IP addresses within the cluster (from 172.16.0.0/16), which means that the external IP client Addresses do not pass properly through Ingress. Could you tell me what I need to configure in addition to the above to make it work?

My Ingress Configuration:

apiVersion: extensions/v1beta1   
kind: Ingress
metadata:
  name: myWebApp
spec:
  backend:
    serviceName: myWebApp
    servicePort: 8080
+4
source share
1 answer

- 4, Nginx IP- IP-. , ( HAProxy, Nginx ).

, , upstream ( myWebApp ) . , Nginx, , .

Nginx Ingress Controller Ingress Controller Kubernetes ConfigMap:

apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-ingress-controller
data:
  use-proxy-protocol: "true"

ConfigMap Ingress, --nginx-configmap=<insert-configmap-name> .

+3

Source: https://habr.com/ru/post/1656251/


All Articles