Nomad Provider
A Story of Tags, Services & Nomads Attach tags to your Nomad services and let Traefik automatically discover and route traffic. The Nomad provider integrates with HashiCorp Nomad’s native service discovery for seamless routing in your Nomad cluster.Quick Start
1
Enable Nomad Provider
2
Add Tags to Nomad Job
job.nomad
3
Deploy Job
How It Works
The Nomad provider:- Queries Nomad API for registered services
- Watches for changes (optional) in real-time
- Extracts routing config from service tags
- Discovers allocation IPs and ports
- Creates routes dynamically
- Updates on events when allocations start/stop
Provider Configuration
endpoint
Nomad server connection settings.address
Default:http://127.0.0.1:4646
token
Optional, Default:""
Nomad ACL token:
Required ACL policy:
read-job capability. See Nomad ACL documentation.endpointWaitTime
Optional, Default:""
Watch block duration:
tls
TLS configuration:prefix
Default:traefik
Tag prefix for configuration:
lb.http.routers.app.rule=...
refreshInterval
Default:15s
Polling interval:
Ignored when
watch: true is enabled.watch
Default:false
Enable real-time event watching:
throttleDuration
Default:0s
Throttle event handling:
exposedByDefault
Default:true
stale
Default:false
Allow stale reads for better performance:
defaultRule
Default:Host(`{{ normalize .Name }}`)
constraints
Optional, Default:""
Filter services by tags:
namespaces (Enterprise)
Optional, Default:""
Watch specific namespaces:
Requires Nomad Enterprise with namespace support.
allowEmptyServices
Default:false
Create load balancers even with no healthy allocations:
Nomad Job Examples
Basic Web Service
Service with Middleware
Multi-Service Job
Canary Deployment
Complete Traefik Deployment
Network Modes
Bridge Mode (Default)
Host Mode
CNI Plugins
Tag Syntax
All Traefik labels work as Nomad tags:- Docker Labels
Troubleshooting
Services Not Discovered
1
Check Nomad Connection
2
Verify Service Registration
3
Check ACL Token
read-job policy is attached.4
Review Traefik Logs
Health Check Issues
Ensure service has health checks:ACL Configuration
Create policy for Traefik:Best Practices
1
Enable Watch Mode
Use
watch: true for real-time updates instead of polling.2
Use Health Checks
Always configure Nomad service health checks.
3
Tag Consistently
Develop a tagging strategy (environment, version, team).
4
Secure ACL Tokens
Use minimum required permissions and rotate tokens regularly.
5
Set Stale Reads
Enable
stale: true for better performance in large clusters.Next Steps
Nomad Routing
Detailed tag configuration reference
Nomad Documentation
Official HashiCorp Nomad documentation