Ingress resource - whitelisting

Is it possible to use the standard whitelisting annotations with the Ingress resource?

Noone got a clue on this?

Whitlisting is done by middlewares. You must first create a middleware with the appropriate configuration (https://docs.traefik.io/middlewares/ipwhitelist/). These can then be referenced as annotations.

apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: test-ipwhitelist
  namespace: my-namespace
spec:
  ipWhiteList:
    sourceRange:
      - 127.0.0.1/32
      - 192.168.1.7

Part of the ingress object:

[...]
annotations:
  traefik.ingress.kubernetes.io/router.middlewares: my-namespace-test-ipwhitelist@kubernetescrd

A bit cumbersome. But it works.

did you ever get this working? I can only get it to block absolutely everything or nothing at all

2 Likes

Hi! Did you have any success with this one? I am having the same problem.