kubernetes 所有traefik插件的“未知插件类型”

u2nhd7ah  于 2023-05-28  发布在  Kubernetes
关注(0)|答案(1)|浏览(227)

我正在使用Traefik作为我的kubernetes的入口,无法使用任何插件。没有插件下载日志。我得到这样的所有插件错误

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

这是我的配置。
静态:

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"

动态:

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

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

hs1ihplo

hs1ihplo1#

Block Path是Traefik的中间件插件,当请求的HTTP路径与配置的regular expressions之一匹配时,它会发送HTTP 403 Forbidden响应。您的静态配置文件对于plugin-blockpath是正确的。
使用动态配置配置插件。

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

你能试着在动态配置中改变正则表达式吗?你可以参考这个document来安装插件。

相关问题