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.

dashboard:
  enabled: true
metrics:
  prometheus:
    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
[...snip...]
# 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

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

Restart Prometheus and You’re Done.

Speak with an expert on our team to discuss Cloud solutions tailored to your business.

You’ll receive free recommendations tailored to your business.