A Singapore Government Agency Website

Ingress IP Restriction

What is IP restriction

To restrict access of IPs into your service or route which includes specific IP address or a CIDR e.g. 127.0.0.1/24.

Why do we use IP-Restriction in our Ingress

IP restriction helps in the way we are able to black and/or white list certain IPs or IP ranges in our application.

apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
  name: ip-restriction-example
config:
  allow:
    # IP/IP range you want to allow
    - 127.0.0.1/32
  # deny:
    # IP/IP range you want to block
    # - 127.0.0.1/32
plugin: ip-restriction
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata: 
  name: <your_ingress_name>
  namespace: <your_namespace>
  annotations:
    konghq.com/plugins: ip-restriction-example
.
spec:
  ingressClassName: kong
.
. #rest of your yaml
.

There are multiple ways to implement IP restriction. You can visit https://docs.konghq.com/hub/kong-inc/ip-restriction for more information.

Chat with me!
Bot Launcher