My structure
- Kubernetes cluster on GKE
- Ingress controller deployed using helm
- An application which will return list of IP ranges note: it will get updated periodically
curl https://allowed.domain.com
172.30.1.210/32,172.30.2.60/32
- Secured application which is not working
What I am trying to do?
- Have my clients IPs in my API endpoint which is done
curl https://allowed.domain.com
172.30.1.210/32,172.30.2.60/32
- Deploy my example app with ingress so it can pull from the
https://allowed.domain.com
and allow people to access to the app
What I tried and didn't work?
- Deploy the application with
include
feature of nginx
nginx.ingress.kubernetes.io/configuration-snippet: |
include /tmp/allowed-ips.conf;
deny all;
yes its working but the problem is when /tmp/allowed-ips.conf
gets updated the ingress config doesn't
- I tried to use if condition to pull the IPs from the endpoint and deny if user is not in the list
nginx.ingress.kubernetes.io/configuration-snippet: |
set $deny_access off;
if ($remote_addr !~ (https://2ce8-73-56-131-204.ngrok.io)) {
set $deny_access on;
}
- I am using
nginx.ingress.kubernetes.io/whitelist-source-range
annotation but that is not what I am looking for
None of the options are working for me.