How to restrict access to your website hosted in AKS with simple trick

tech kamar
May 17, 2024

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

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response