Traefik 插件实验性配置¶
概述¶
本指南介绍如何在 Traefik 中配置并使用新的实验性 plugins 安装配置选项。plugins 选项引入了一套机制,可通过自定义中间件和提供者扩展 Traefik 的能力。
实验性功能
plugins 选项目前处于实验阶段,未来版本可能发生变化。
在生产环境中使用时请谨慎。
启用插件¶
plugins 选项是一个安装配置参数。 要启用插件,需要在 Traefik 的安装配置中定义它。
experimental:
plugins:
plugin-name: # The name of the plugin in the routing configuration
moduleName: "github.com/github-organization/github-repository" # The plugin module name
version: "vX.XX.X" # The version to use[experimental.plugins.plugin-name]
moduleName = "github.com/github-organization/github-repository" # The plugin module name
version = "vX.XX.X" # The version to use# The plugin module name
# With plugin-name the name of the plugin in the routing configuration
--experimental.plugins.plugin-name.modulename=github.com/github-organization/github-repository
--experimental.plugins.plugin-name.version=vX.XX.X # The version to use有关如何向 Traefik 实例添加新插件的更多信息,请参阅开发者文档。
插件选项¶
| 字段 | 说明 | 类型 | 必填 |
|---|---|---|---|
moduleName |
插件的模块名。 | string | 是 |
version |
插件版本。 | string | 是 |
hash |
用于验证插件的哈希值。 | string | 否 |
settings |
插件的设置(仅适用于 wasm 插件)。 | object | 否 |
settings.envs |
转发给 wasm 客体的环境变量。 | []string | 否 |
settings.mounts |
挂载到 wasm 客体的目录。 | []string | 否 |
settings.useUnsafe |
允许插件使用 unsafe 和 syscall 包。 | bool | 否 |
本地插件¶
本地插件允许你直接使用本地目录中的插件,无需将它们发布到 Traefik 插件目录。
experimental:
localPlugins:
plugin-name: # The name of the plugin in the routing configuration
moduleName: "github.com/github-organization/github-repository" # The plugin module name[experimental.localPlugins.plugin-name]
moduleName = "github.com/github-organization/github-repository" # The plugin module name# The plugin module name
# With plugin-name the name of the plugin in the routing configuration
--experimental.localplugins.plugin-name.modulename=github.com/github-organization/github-repository本地插件选项¶
| 字段 | 说明 | 类型 | 必填 |
|---|---|---|---|
moduleName |
插件的模块名。 | string | 是 |
settings |
插件的设置(仅适用于 wasm 插件)。 | object | 否 |
settings.envs |
转发给 wasm 客体的环境变量。 | []string | 否 |
settings.mounts |
挂载到 wasm 客体的目录。 | []string | 否 |
settings.useUnsafe |
允许插件使用 unsafe 和 syscall 包。 | bool | 否 |