-
Notifications
You must be signed in to change notification settings - Fork 2.4k
basic auth when running inside of a container #784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@pacuna you will need to inject the required files into a Docker image you derive from the cAdvisor one. Something like:
To generate the file take a look at this doc which has some pointers. Let us know if you have any questions or run into trouble. |
@vmarmol thanks!! |
I just want to add some information. @vmarmol 's answer is just fine, but, sadly there is a typing error. It should be: I'm totally new with Docker, so it was hard to see what actually went wrong. After attaching to the container, i was able to see that something wasn't added like it should (Well.. i just took two hours to figure that out - Rofl):
So in the last line, you need to seperate --http_auth_realm and localhost. And... For all the other people, trying to find a nice solution with Google searches and stuff - Here is what i thing is the most easy way to add this:
Paste in the informations:
Note that i have added "restart=always". This means that cAdvisor will start with the system. I personally changed publish from the default to "--publish=8383:8080 " cause of another resource, running at port 8080. Hopefully this can help other people, trying to get cAdvisor working with Docker WITH PASSWORD support. Please ask, if you read this and have any questions - and if you spot typing errors. Update:
|
Thanks @vmarmol and @exetico! your answers helped me out a lot on this one. If you guys are by chance interested I took your advise and put it into a container on docker hub - https://hub.docker.com/r/tim545/cadvisor-basicauth It works pretty well, I'm using it on a personal server at the moment. you can get it going in a few commands:
The only spot where I fell short was parsing the environment variables in straight from the From what I understand it could be done by replacing
I'm not very good with writing bash scripts and I think there's some extra things you need to do to make it work when being run from a docker container, but I think my main issue was being able to parse the
Note: For anyone who just skipped to here, the above command does not work When I get some more time to spend on it I'll try again, but any help/pointers or even a PR would be appreciated. |
Hi @tim545. I will give it a try, in my new ESXi setup at home. I think it will be a good idea to point out, how to use the arguments in the information. |
Thanks @exetico, let me know how it goes. I updated the readme a bit to try and make the instructions clearer like you mentioned. |
Thank you guys your comments were really useful. What I unfortunately miss is the implementation of basic auth in the Prometheus metrics endpoint (/metrics). The code has nothing about it and it is a feature I really need. Maybe I can contribute with it soon. |
@gustavomcarmo is there some updates with implementing basic auth for prometheus endpoint? |
Gustavo's solution is good, but also if you don't publish the port and add it to the internal Prometheus network I think you would also be safe, you could access from Grafana to the API. |
This is probably obvious to many, but in case it isn't for all: the alternative is to block the cAdvisor port on the server firewall (e.g. drop 8080) and use ssh port forwarding Open a new terminal on your local machine and enter (updating domain, user and certification details you can omit -i value if you are using user/pass ssh)
Then open your browser to locahost:8080 and cAdvisor will appear. |
You just need set ENV VARIABLES for basic auth This repo could help you https://github.com/vuongtlt13/prometheus_exporters |
can someone explain me how should I use the basic auth feature for the web-ui when running cadvisor inside of a container?
Thanks in advance.
The text was updated successfully, but these errors were encountered: