Is there any way of blocking access to a server via IP?

Domenico Mastrangelo 1 Reputation point
2022-12-16T12:57:07+00:00

I have an AKS setup with an NGINX load balancer and everything works perfectly, all the ingresses work and all the networking is flawless.

For security purposes I need to block access to the server via load balancer IP, is there a way to do so? I searched all over Google and the consensus seems to be that there just isn't a way to do so in K8S.

When the IP is accessed via HTTP, everything is fine and NGINX responds with a 404. But when the IP is accessed via HTTPS (even thought I explicitly disabled listening on port 443 in NGINX), I'm served a fake k8s certificate, which I belive is not served by NGINX, but by the K8S service (or am I wrong?)

Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
Azure Load Balancer
Azure Load Balancer
An Azure service that delivers high availability and network performance to applications.
{count} votes

2 answers

Sort by: Most helpful
  1. Amjad Aljunaidi 6 Reputation points Microsoft Employee
    2022-12-20T10:20:49.083+00:00

  2. Narad Kumar Singh 1 Reputation point
    2022-12-24T08:57:07.853+00:00

    Try to disable all IP and whitelist your system or own ip which you are looking for to be access. As if you block one IP might it get hit through other IP.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.