How to restrict access to your website hosted in AKS with simple trick
I use AKS to host websites at work.
We route all traffic to website using a single NGINX pod. There is a service associated with this pod which is open to public. This is how we restrict access. You can use single IP with /32 at the end or add more with subnetting
apiVersion: v1
kind: Service
metadata:
name: ui-server
spec:
type: LoadBalancer
ports:
- port: 80
selector:
app: ui-server
loadBalancerSourceRanges:
- 172.172.127.72/32
- 172.172.127.80/32
In the above snippet, we have allowed access to only 2 IPs