A Traefik provider that automatically configures routing based on Proxmox VE virtual machines and containers.
experimental:plugins:traefik-proxmox-provider:moduleName: github.com/NX211/traefik-proxmox-providerversion: v0.7.0
# Dynamic configurationproviders:plugin:traefik-proxmox-provider:pollInterval: "30s"apiEndpoint: "https://proxmox.example.com"apiTokenId: "root@pam!traefik_prod"apiToken: "your-api-token"apiLogging: "info"apiValidateSSL: "true"
Option | Type | Default | Description |
---|---|---|---|
pollInterval | string | "30s" | How often to poll the Proxmox API for changes |
apiEndpoint | string | - | The URL of your Proxmox VE API |
apiTokenId | string | - | The API token ID (e.g., "root@pam!traefik_prod") |
apiToken | string | - | The API token secret |
apiLogging | string | "info" | Log level for API operations ("debug" or "info") |
apiValidateSSL | string | "true" | Whether to validate SSL certificates |
The Traefik Proxmox Provider needs an API token with specific permissions to read VM and container information. Here's how to set up the proper token and permissions:
# Create a role for Traefik provider with minimum required permissionspveum role add traefik-provider -privs "VM.Audit,VM.Monitor,Sys.Audit,Datastore.Audit"# Create an API token for your user (replace with your actual username)pveum user token add root@pam traefik_prod# Assign the role to the token for all pathspveum acl modify / -token 'root@pam!traefik_prod' -role traefik-provider
Make sure to save the API token value when it's displayed, as it won't be shown again.
Create an API token in Proxmox VE as described above
Configure the provider in your Traefik configuration:
apiEndpoint
to your Proxmox VE server URLapiTokenId
and apiToken
from step 1Very Important: Add Traefik labels to your VMs/containers:
traefik.key=value
traefik.enable=true
to enable Traefik for this VM/containerRestart Traefik to load the new configuration
The provider looks for Traefik labels in the VM/container notes field. Each line in the Notes field starting with traefik.
will be treated as a Traefik label.
traefik.enable=true
- Without this label, the VM/container will be ignoredtraefik.http.routers.<name>.rule=Host(
myapp.example.com)
- The router rule for this servicetraefik.http.services.<name>.loadbalancer.server.port=8080
- The port to route traffic to (defaults to 80)traefik.enable=true
traefik.http.routers.myapp.rule=Host(`myapp.example.com`)
traefik.http.services.appservice.loadbalancer.server.port=8080
traefik.http.routers.myapp.service=appservice
traefik.http.routers.myapp.entrypoints=websecure
traefik.http.routers.myapp.middlewares=compression,auth@file
traefik.http.routers.myapp.tls=true
traefik.http.routers.myapp.tls.certresolver=myresolver
traefik.http.routers.myapp.tls.domains=example.com
traefik.http.routers.myapp.tls.options=tlsoptions@file
traefik.http.services.myservice.loadbalancer.healthcheck.path=/health
traefik.http.services.myservice.loadbalancer.healthcheck.interval=10s
traefik.http.services.myservice.loadbalancer.healthcheck.timeout=5s
traefik.http.services.myservice.loadbalancer.sticky.cookie.name=session
traefik.http.services.myservice.loadbalancer.sticky.cookie.secure=true
traefik.http.services.myservice.loadbalancer.sticky.cookie.httponly=true
traefik.http.services.myservice.loadbalancer.server.scheme=https
My application server
Some notes about this server
traefik.enable=true
traefik.http.routers.myapp.rule=Host(`myapp.example.com`)
traefik.http.routers.myapp.entrypoints=websecure
traefik.http.routers.myapp.middlewares=auth@file,compression
traefik.http.routers.myapp.tls=true
traefik.http.routers.myapp.tls.certresolver=myresolver
traefik.http.services.myapp.loadbalancer.server.port=8080
traefik.http.services.myapp.loadbalancer.healthcheck.path=/health
traefik.enable=true
is found, it creates a Traefik router and serviceproviders:plugin:traefik-proxmox-provider:pollInterval: "30s"apiEndpoint: "https://proxmox.example.com"apiTokenId: "root@pam!traefik_prod"apiToken: "your-api-token"apiLogging: "debug" # Use debug for troubleshootingapiValidateSSL: "true"
Simple web server:
traefik.enable=true
traefik.http.routers.app.rule=Host(`myapp.example.com`)
Secure website with HTTPS:
traefik.enable=true
traefik.http.routers.secure.rule=Host(`secure.example.com`)
traefik.http.routers.secure.entrypoints=websecure
traefik.http.routers.secure.tls=true
traefik.http.routers.secure.tls.certresolver=dnschallenge
API with authentication and rate limiting:
traefik.enable=true
traefik.http.routers.api.rule=Host(`api.example.com`)
traefik.http.routers.api.middlewares=auth@file,ratelimit@file
traefik.http.services.api.loadbalancer.server.port=3000
Multiple hosts with path-based routing:
traefik.enable=true
traefik.http.routers.multi.rule=Host(`example.com`,`www.example.com`) && PathPrefix(`/api`)
traefik.http.routers.multi.priority=100
If your services aren't being discovered:
apiLogging: "debug"
traefik.enable=true
in their notes fieldContributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.