“unknown plugin type” for all traefik plugins

862 Views Asked by At

I am using Traefik as an ingress for my kubernetes and am unable to use any plugin. No logs for plugin getting downloaded. I get error for all plugins like this

time="2023-05-18T02:01:32Z" level=error msg="plugin: unknown plugin type: plugin-blockpath" routerName=dev1-api-gateway-dev1-api-gateway-dev-company-com@kubernetes entryPointName=websecure

Here is my config.

Static:

  values:
    ingressClass:
      enabled: true
      isDefaultClass: true
    ingressRoute:
      dashboard:
        enabled: false
    service:
      annotations:
        service.beta.kubernetes.io/aws-load-balancer-type: nlb
    providers:
      kubernetesCRD:
        enabled: true
      kubernetesIngress:
        enabled: true
        publishedService:
          enabled: true
    ports:
      websecure:
        tls:
          enabled: true
      web:
        redirectTo: websecure
    experimental:
      plugins:
        plugin-blockpath:
          moduleName: "github.com/traefik/plugin-blockpath"
          version: "v0.2.1"

Dynamic:

apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: blockpath-health
spec:
  plugin:
    plugin-blockpath:
      Regex:
        - ^/actuator/health(.*)

Annotation:

traefik.ingress.kubernetes.io/router.middlewares: flux-system-blockpath-health@kubernetescrd

1

There are 1 best solutions below

3
On

Block Path is a middleware plugin for Traefik which sends an HTTP 403 Forbidden response when the requested HTTP path matches one of the configured regular expressions. Your static configuration file is correct for plugin-blockpath.

Configure plugin using the Dynamic Configuration.

apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
    name: my-plugin-blockpath
    namespace: my-namespace
spec:
    plugin:
        plugin-blockpath:
            Regex:
                - ^/foo(.*)

Can you try changing the regex in dynamic configuration as above. You can refer to this document for plugin installation.