Restricting Access By IP (Allow/Block Listing) using NGINX-Ingress Controller in Kubernetes

Restricting Access By IP (Allow/Block Listing) using NGINX-Ingress Controller in Kubernetes

The demo aims at running an application in Kubernetes behind a Cloud-managed public load balancer also known as an HTTP(s) load balancer which is also known as an Ingress resource in Kubernetes dictionary. For this demo, I will be using Google Kubernetes Engine. Also, instead of using a default ingress controller that GCP makes of its own, I will be creating an NGINX ingress controller which will be used by the Ingress resource. Using this NGINX ingress controller we will be allowing IP addresses and eventually blocking others from accessing our application running in GKE. Before we start with the implementation, let us get some of our prerequisites revised.

The demo aims at running an application in Kubernetes behind a Cloud-managed public load balancer also known as an HTTP(s) load balancer which is also known as an** Ingress resource** in Kubernetes dictionary. For this demo, I will be using Google Kubernetes Engine. Also, instead of using a default ingress controller that GCP makes of its own, I will be creating an NGINX ingress controller which will be used by the Ingress resource. Using this NGINX ingress controller we will be allowing IP addresses and eventually blocking others from accessing our application running in GKE. Before we start with the implementation, let us get some of our prerequisites revised.

What is Ingress in Kubernetes?

In Kubernetes, an Ingress is an object or a resource that allows access to your Kubernetes services from outside the Kubernetes cluster. One can configure access by creating a collection of rules that define which inbound connections can reach which services. In GKE, when we specify kind: Ingress in the resource manifest. GKE then creates an Ingress resource making appropriate Google Cloud API calls to create an external HTTP(S) load balancer. The load balancer’s URL maps host rules and path matches, to refer to one or more backend services, where each backend service corresponds to a GKE Service of type NodePort, as referenced in the Ingress.

But then…..

What is Ingress Controller in Kubernetes?

For the Ingress resource to work, the cluster must have an ingress controller running. There multiple Ingress controllers available and they can be configured with the Ingress resource eg. NGINX Ingress Controller, HAproxy Ingress controller, Traefik, Contour, etc.

We will be using the NGINX Ingress Controller for the demo.

So now…..

kubernetes load-balancer ingress nginx ip

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

50+ Useful Kubernetes Tools for 2020 - Part 2

Our original Kubernetes tool list was so popular that we've curated another great list of tools to help you improve your functionality with the platform.

Configuring NGINX Plus as an External Load Balancer for Red Hat OCP and Kubernetes

The NGINX Load Balancer Operator is a reference architecture for automating reconfiguration of the external NGINX Plus load balancer for your Red Hat OCP or a Kubernetes cluster, based on changes to the status of the containerized applications.

Sample Load balancing solution with Docker and Nginx

Sample Load balancing solution with Docker and Nginx - Most of today's business applications use load balancing to distribute traffic among different resources and avoid overload of a single…

How-to kubectl LoadBalancer and configure Nginx Ingress controller for a GCP Cluster

Have you ever wondered you could have written your own LoadBalancer for K8s instead of going through all the documentation out there , well then look no further! I will walk you through the setup for bringing up a Nginx Ingress Controller and a Layer 4 LoadBalancer on a Kubernetes GCP cluster

AWS Application Load Balancer vs. NGINX Plus

We compare AWS Application Load Balancer (ALB) with NGINX Open Source and NGINX Plus as a Layer 7 reverse proxy and load balancer. ALB has more features than at its debut in 2016, but we conclude that NGINX and NGINX Plus still provide more functionality and much more predictable pricing.