Question about Service name in metrics

Hello! First Post!

I have a question regarding the reported service name as seen in the metrics. For example:

traefik_service_requests_total{code="200",method="GET",protocol="http",service="xxxx-xxxxxx-traefik-ingress-9d50afc83b446c8a5c01@kubernetescrd"} 1059

My question is as follows: Is there a way to have it show the actual service name the router is forwarding to instead of this generated name?


I'm sorry, I did not look in depth at metrics, but from common sense:

  • Traefik service is not the same as kubernetes service
  • From you excerpt, it looks like what is being shown is the traefik name
  • It does not look like there is a way to provide the service name in the IngressRoute object for that purpose. The service name is always generated.
  • So as it is now, no, it is not possible

@ldez would you support it if I write a GitHub feature request for this, or do we already have anything similar? It seems a few other options are also missing on IngressRoute, e.g sans for LE certificates, service stickiness, mirroring, etc.

Thanks @zespri for your reply. It would be nice if the name can be defined. This came up when I added Traefik metrics into Prometheus. As I started looking at the data, it was hard to determine which service referred to what. It's easy to tell in the Traefik dashboard since each Traefik service prints out the configured rule, but not outsides that dashboard.

I noticed this open PR if merged, it can resolved the issue.

Awesome thanks for that! I will keep an eye out on that PR.

It doesn't look like the PR is solving the problem as I still see this happening in v2.1.2, or am I missing something?


I did not have much experience with metrics, so I cannot definitely tell you if it is resolved or now, it looks like it should. Of course it goes without saying, that you have to update your configuration accordingly, ot take advantage of that PR. If you did not change anything in your configs, that I would expect no change in this behaviour either. Having said that, I have not tried that personally, so I do not have a definite answer.

Are you able to tell us in this thread what you should be changing in the configs to be able to see the correct service names in the metrics ?

Im useing kubernetes and traefik and are having trouble using the metrics for anything at the moment.

@larsbloch I have not tried it but it looks like property name of kind TrafeikService is what you need to set.

Hi, I just stumbled upon this thread since I was also annoyed by the lengthy and cryptic service specifiers. So I tried the method proposed in the PR:

  • I added a TraefikService in addition to the kubernetes service
  • I referred to this service in the ingress definition

This is successful in terms that it removes the hash from the service name. But from what I see at the moment, it always results in two services shown in traefik:

  • a service of type weighted or mirroring -> naming scheme namespace-name
  • at least one service of type loadbalancer -> naming scheme namespace-name-port

So my question is: Is it possible to directly create a TraefikService of type loadbalancer? Since I run only one backend anyway I would like to skip the additional service... But I don't see anything like that in the documentation.

To have some example code:

apiVersion: v1
kind: Service
  name: grafana # -> results in namespace-grafana-http-grafana-HASHHASHHASHHASH@kubernetescrd
    - port: 3000
      protocol: TCP
      targetPort: http-grafana
    app: grafana
  sessionAffinity: None
  type: LoadBalancer
kind: TraefikService
  name: grafana # -> results in namespace-grafana@kubernetescrd service
      - name: grafana # -> results in namespace-grafana-3000@kubernetescrd service
        weight: 1
        port: 3000
kind: IngressRoute
  name: grafana-web-https
    - websecure
    - match: Host(``)
      kind: Rule
        - name: grafana
          port: 3000
          kind: TraefikService  
    secretName: grafana-tls