Middleware ipwhitelist per service

Hello there,

According to the docs, we can define a middleware in kubernetes. I am not that familiar with it, but can it be defined per service? Or is it for all services handled by the traefik ingress controller?

For information, I am using k3os/k3s.

Thanks in advance.

Hi there!

Pieces of middleware are attached to “routers” (components that point to services).

So you can have different ipwhitelists depending on anything you want.

Let me know if the documentation I pointed to is enough information.

Hope this help!

Hi there,

Thanks for the link it makes sense now. But I have another question/request. The middleware part in the doc is pretty clear to me with example for docker, k8s, … however the router part only have the docker one.
Would it be possible to clarify this point and maybe update the docs with more examples?

Thank in advance.

Here is an example of an IngressRoute w/ middleware from the V2 K8S documentation

apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
  name: stripprefix

      - /stripit

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
  name: ingressroutebar

    - web
  - match: Host(`bar.com`) && PathPrefix(`/stripit`)
    kind: Rule
    - name: whoami
      port: 80
    - name: stripprefix

Let me know if this helped!

did you ever get ipwhitelist to work? I can only seem to get it to block everything or nothing.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.