I have created an Nginx VirtualServer ingress resource which has multiple paths:
apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
name: web-server-ingress-vs
namespace: web
spec:
host: somehost.com
upstreams:
- name: web-test
service: web-server-service
port: 5000
- name: another-one
service: web-server-service
port: 5000
routes:
- path: /
action:
pass: web-test
- path: /test-another-one
location-snippets: |
deny all;
allow some-subnet/24; # would like to allow only ingress from a certain ip range/address.
action:
pass: another-one
For certain paths, I would like to deny all access and only allow access from a certain IP address or range of addresses in the case of a local subnet. All addresses should be in CIDR notation.
Having "deny all" and then followed by an "allow" with some IP address/range (CIDR notation) like in the YAML above, it just denies all. I have tried adding in only the "allow" with a single IP address (CIDR notation /32) but it still allows access from other addresses.
Is this something that can be done or not? If it can, how? Thanks
Ingress controller = Nginx. All of this is running in AWS and Kubernetes.