I'm having issues to get the real client IP on a Kubernetes cluster v1.10.11
On my previous version Kubernetes 1.6.1 I had configured a nginx pod with a NodePort service and for that service I was using this old fashion annotation:
annotations:
service.beta.kubernetes.io/external-traffic: OnlyLocal
And everything worked fine. This was the whole yaml service configuration:
apiVersion: v1
kind: Service
metadata:
name: nginx-svc
labels:
app: nginx
annotations:
service.beta.kubernetes.io/external-traffic: OnlyLocal
spec:
type: NodePort
ports:
- port: 80
nodePort: 30080
protocol: TCP
name: http
- port: 443
nodePort: 30443
protocol: TCP
name: https
selector:
app: nginx
Now I'm using Kubernetes 1.10.11 over Ubuntu 16.04.4 LTS with Kernel 4.4.0-165-generic and docker 18.6.2.
I'm trying to use the new service.spec.externalTrafficPolicy: Local
as described in this documentation and in this documentation however I'm not getting the real client IP.
I'm using same service and same pods configuration as I had in the past when using Kubernetes v1.6.1, just removing the old annotation and using service.spec.externalTrafficPolicy
.
This is the new whole Service yaml file:
apiVersion: v1
kind: Service
metadata:
name: nginx-svc
labels:
app: nginx
spec:
type: NodePort
externalTrafficPolicy: Local
ports:
- port: 80
nodePort: 30080
protocol: TCP
name: http
- port: 443
nodePort: 30443
protocol: TCP
name: https
selector:
app: nginx
I'm asking here the question because I've followed official documentation and I have read all the similar issues described here in StackOverflow without success:
It's good to mention that I'm hosting my own cluster not using AWS, GCE, etc.
Any ideas what's going on? any suggestions to get this fixed?
Thanks !