First of all i'd like to thank the creators for building Traefik 2.0. So far I really love it!
So i'm running into an issue which i'm unable to find information about. I am using the file configuration (traefik.yml). I'm trying to get a prometheus endpoint up and running with auth on it. I can't seem to find what the service of prometheus is called (like api@internal for the api).
Does anyone know how to add authentication to prometheus and/or how the prometheus service is called?
I dont get any errors in the config, but the prometheus endpoint doesnt have any authentication on it (i expect it to show a basic auth popup, but it doesnt).
Alright let me try to rephrase the underlying question then: How do I put authentication on the prometheus metrics page from Traefik like I was able to in Traefik 1.x? (i'm talking about the /metrics page)
I have not tried it, but from the conversation above, it looks, like what you've done might have worked if you just created Prometheus manually, instead of trying to use prometheus@internal. It sounds like this is the changes that is needed to get you there.
Alright, but how do i expose the /metrics endpoint on Traefik? And how do i add authentication to that endpoint? In Traefik 1.x this was possible, but i can't figure out how to do it on 2.x.
The problem i'm having is that i'm trying to enable basic auth on this /metrics endpoint, but I can't figure out how to do this. This used to be possible in Traefik 1.x, but it appears this isn't supported in Traefik 2.x.
I understand that, I'm just not sure which part you need help with. You simply write your config the way your wrote but instead of using prometheus@internal you define a service for metrics and point to that service from the router. You do this exactly the same way as you would do with any other application you route a traefik request to. I think we are going in circles here, but I don't know how to progress since I don't understand what's not clear.
Here you expose /metrics on 5443, then you create a service to point to that port, a router to point to that service, and then you can access it at http://yourhost/metrics. You will have provide credentials such as test:test.
Hi! I tried to reproduce this by translating this to a YAML structure, but i dont get a basic auth popup. So i can enter the /metrics anonymously. Please see my current config attached:
I'm sorry, what do you mean by static and dynamic configuration? Above configuration is the only configuration i'm using (I dont use a docker backend or something in that liking). Also i don't add labels to containers.
So I can't use entrypoints (static) AND routers (dynamic) for example? I have to choose between the two? This really confuses me. How does traefik work without entrypoints?
I'm totally lost now. Can you provide an example of what i'm trying to achieve (a metrics page with auth) using the YAML filestructure (without docker compose or labels on dockers etc)?
From the page you referenced, I can't find out what I seem to be doing wrong.
PS. Sorry for me not understanding this, i'm relatively new to Traefik.