# Error with Middleware and Plugin Demo Configuration: "invalid middleware type or middleware does not exist"

**URL:** <https://community.traefik.io/t/error-with-middleware-and-plugin-demo-configuration-invalid-middleware-type-or-middleware-does-not-exist/18771>\
**Category:** Traefik v2\
**Tags:** kubernetes-crd, plugin, middleware\
**Created:** [May 31, 2023, 10:20am UTC](https://community.traefik.io/t/error-with-middleware-and-plugin-demo-configuration-invalid-middleware-type-or-middleware-does-not-exist/18771 "2023-05-31T10:20:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chximn](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/chximn/32/7176_2.png) [@chximn](https://community.traefik.io/u/chximn)\
**Post date:** [May 31, 2023, 10:20am UTC](https://community.traefik.io/t/error-with-middleware-and-plugin-demo-configuration-invalid-middleware-type-or-middleware-does-not-exist/18771/1 "2023-05-31T10:20:53Z")

</div>

Hi Traefik community,

I'm currently facing an issue with configuring a middleware that utilizes the Plugin Demo in Traefik using Kubernetes CRD (Custom Resource Definition). I have followed the documentation and created the necessary middleware, but I keep encountering the following error message:

```plaintext
invalid middleware 'default-plugindemo@kubernetescrd' configuration: invalid middleware type or middleware does not exist

```

Here's a screenshot capturing the error displayed on the Traefik dashboard.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/7/7a633aa16f17f8e061f68c545b817d5f388af3fa.png)

Here's the full YAML configuration file for kubernetes containing:

- Traefik Helm chart configuration
- `whoami` application deployment and service
- Middleware configuration
- IngressRoute configuration

```auto

apiVersion: apps/v1
kind: Deployment
metadata:
  name: whoami
  labels:
    app: whoami
spec:
  selector:
    matchLabels:
      app: whoami
  template:
    metadata:
      labels:
        app: whoami
    spec:
      containers:
      - name: whoami
        image: traefik/whoami

---
apiVersion: v1
kind: Service
metadata:
  name: whoami-svc
spec:
  selector:
    app: whoami
  ports:
    - name: http
      protocol: TCP
      port: 80
  type: ClusterIP

---
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
  name: traefik
  namespace: kube-system
spec:
  valuesContent: |-
    additionalArguments:
      - "--api.dashboard=true"
      - "--log.level=DEBUG"
      - "--experimental.plugins.plugindemo.moduleName=github.com/traefik/plugindemo"
      - "--experimental.plugins.plugindemo.version=v0.2.2"
    ports:
      traefik:
        expose: true
    providers:
      kubernetesCRD:
        allowCrossNamespace: true
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: plugindemo
spec:
  plugin:
    plugindemo:
      Headers:
        X-Demo: test
        X-URL: '{{URL}}'

---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: traefik-whoami
spec:
  entryPoints:
  - web
  routes:
  - kind: Rule
    match: PathPrefix("/whoami")
    services:
    - name: whoami-svc
      port: 80
    middlewares:
      - name: plugindemo

```

Providing some additional context, I'm using Traefik v2.9.4 on a K3S cluster.  
I have also tried using built-in middleware, like StripPrefix, and it worked just fine.

Can you please help me understand why I am encountering this error? Is there something incorrect with my middleware or CRD configuration? Any suggestions or insights would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![mohamed-abdelrhman](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/mohamed-abdelrhman/32/7403_2.png) [@mohamed-abdelrhman](https://community.traefik.io/u/mohamed-abdelrhman)\
**Post date:** [July 29, 2023, 2:49pm UTC](https://community.traefik.io/t/error-with-middleware-and-plugin-demo-configuration-invalid-middleware-type-or-middleware-does-not-exist/18771/2 "2023-07-29T14:49:09Z")

</div>

i have the same issue,  
does any one have a solution for this ??

---

<div class="post-metadata">

**Author:** ![darkowlzz](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/darkowlzz/32/7621_2.png) [@darkowlzz](https://community.traefik.io/u/darkowlzz)\
**Post date:** [September 25, 2023, 12:08pm UTC](https://community.traefik.io/t/error-with-middleware-and-plugin-demo-configuration-invalid-middleware-type-or-middleware-does-not-exist/18771/3 "2023-09-25T12:08:05Z")

</div>

Hi, I had the same issue and came across this post. I made it work by setting the following helm chart values:

```yaml
    experimental:
      plugins:
        enabled: true

```

Refer [https://github.com/traefik/traefik-helm-chart/blob/v24.0.0/traefik/values.yaml#L124](https://github.com/traefik/traefik-helm-chart/blob/v24.0.0/traefik/values.yaml#L124) .
