How to configure Traefik Exporter for Prometheus


Enabling Metrics in Traefik

To activate metrics inside of Traefik, we need to configure it in the values.yaml of the Traefik helm chart. Similar to what we have below.

  enabled: true
    enabled: true

Confirm metrics are working

Next, we need to check and make sure that traefik is reporting the stats we need for Prometheus:

$ curl -s "http://traefik:8080/metrics
# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 6.8114e-05
go_gc_duration_seconds{quantile="0.25"} 0.000139405
go_gc_duration_seconds{quantile="0.5"} 0.00015938
go_gc_duration_seconds{quantile="0.75"} 0.000227684
# HELP traefik_config_last_reload_failure Last config reload failure
# TYPE traefik_config_last_reload_failure gauge
traefik_config_last_reload_failure 1.538528571e+09
# HELP traefik_config_last_reload_success Last config reload success
# TYPE traefik_config_last_reload_success gauge
traefik_config_last_reload_success 1.538528571e+09
# HELP traefik_config_reloads_failure_total Config failure reloads
# TYPE traefik_config_reloads_failure_total counter
traefik_config_reloads_failure_total 1
# HELP traefik_config_reloads_total Config reloads
# TYPE traefik_config_reloads_total counter
traefik_config_reloads_total 3

Configure Prometheus

  - job_name: 'Traefik'
      - targets: ['traefik.kube-system.svc.cluster.local:8080']

Restart Prometheus and You’re Done.

By Dennis Otugo

Dennis Otugo is a Consultant at Bantrain, and loves all things DevOps. In his role, he enables enterprise customers in their digital transformation journey and helps architect cloud-native solutions