I have a backend application behind an nginx ingress controller in a GKE cluster and I want to whitelist a certain IP only to access it. I added to the associated ingress this annotation:
nginx.ingress.kubernetes.io/whitelist-source-range: "my-ip/32"
I also have the externalTrafficPolicy
set to Local
in the ingress controller service.
The issue is that when I hit my application it always return 403 Forbidden
And in the ingress controller logs when I hit the application it logs access forbidden by rule, client: 127.0.0.1, server: my-appliaction.domain.ext
which means that the client IP is not forwarded to the ingress controller.
Here is my Ingress manifest:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my_app
annotations:
nginx.ingress.kubernetes.io/whitelist-source-range: x.x.x.x/32
spec:
ingressClassName: nginx
rules:
- host: my_app.company.com
http:
paths:
- backend:
service:
name: my_app
port:
number: 80
path: /
pathType: ImplementationSpecific
tls:
- hosts:
- my_app.company.com
secretName: certificate.tls
Did I miss something?
Thanks in advance.