# K8s middldeware not working

**URL:** <https://community.traefik.io/t/k8s-middldeware-not-working/5693>\
**Category:** Traefik v2\
**Tags:** kubernetes-ingress\
**Created:** [April 24, 2020, 1:20pm UTC](https://community.traefik.io/t/k8s-middldeware-not-working/5693 "2020-04-24T13:20:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mojo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/mojo/32/1962_2.png) [@mojo](https://community.traefik.io/u/mojo)\
**Post date:** [April 24, 2020, 1:20pm UTC](https://community.traefik.io/t/k8s-middldeware-not-working/5693/1 "2020-04-24T13:20:56Z")

</div>

The following K8s implementation correctly creates an IngressRoute however the rate limiting is not applied.

```
kind: Deployment
apiVersion: apps/v1
metadata:
  name: whoami
  labels:
    app: containous
    name: whoami
spec:
  replicas: 2
  selector:
    matchLabels:
      app: containous
      task: whoami
  template:
    metadata:
      labels:
        app: containous
        task: whoami
    spec:
      containers:
        - name: containouswhoami
          image: containous/whoami
          ports:
            - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: service-test
spec:
  ports:
    - name: http
      port: 80
  selector:
    app: containous
    task: whoami
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: fontend
spec:
  entryPoints: 
    - web
  routes:
     - middlewares: 
       - name: service-rate-limiter
     - match: Path(`/bar`)
       kind: Rule
       services:
        - name: service-test
          port: 80
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: service-rate-limiter
spec:
  rateLimit:
    average: 1
    period: 100

```

Can anyone help?

Cheers

---

<div class="post-metadata">

**Author:** ![rdgacarvalho](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/rdgacarvalho/32/1903_2.png) [@rdgacarvalho](https://community.traefik.io/u/rdgacarvalho)\
**Post date:** [April 24, 2020, 4:48pm UTC](https://community.traefik.io/t/k8s-middldeware-not-working/5693/2 "2020-04-24T16:48:02Z")

</div>

Hi @mojo,

Can you be more explicit when you mean "rate limiting"?

Cheers

---

<div class="post-metadata">

**Author:** ![mojo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/mojo/32/1962_2.png) [@mojo](https://community.traefik.io/u/mojo)\
**Post date:** [April 24, 2020, 11:16pm UTC](https://community.traefik.io/t/k8s-middldeware-not-working/5693/3 "2020-04-24T23:16:00Z")

</div>

Hi,

Sorry, I want to limit the service to receive 1 request max per 100 (as a very constrained test). This doesn't appear to work - the service will accept more requests than that.

Cheers!
