Skip to content
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

Prometheus scrape metrics #427

Open
blezoray opened this issue May 2, 2024 · 2 comments
Open

Prometheus scrape metrics #427

blezoray opened this issue May 2, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@blezoray
Copy link

blezoray commented May 2, 2024

Hello,

I deployed kube-green with OLM on an Openshift platform and I would like to configure my local Prometheus to scrape its metrics.
But, when I try to configure it, queries returns server returned HTTP status 400 Bad Request on both ports 8443 and 9443.

After some investigation, it appears that /metrics is exposed only on the localhost:

    spec:
      containers:
      - args:
        - --health-probe-bind-address=:8081
        - --metrics-bind-address=127.0.0.1:8080
        - --leader-elect
        command:
        - /manager

There is also a service named kube-green-controller-manager-metrics-service on port 8443. But it is protected by the sidecar kube-rbac-proxy and a query returns 401 Unauthorized.

What is the solution to bypass the kube-rbac-proxy ?

Rgds.

@davidebianchi davidebianchi added the bug Something isn't working label May 19, 2024
@davidebianchi
Copy link
Member

davidebianchi commented May 19, 2024

Hi @blezoray! We should address it.

I link this issue which could help in the resolution of this issue.

At the same page, there is some documentation on how to give to the prometheus operator the permissions to scrape the metrics: https://book.kubebuilder.io/reference/metrics#exporting-metrics-for-prometheus

@blezoray
Copy link
Author

Thanks.
If I understand correctly the prometheus ServiceAccount should have permissions to /metrics, like in this example: https://github.com/brancz/kube-rbac-proxy/blob/master/examples/non-resource-url/client-rbac.yaml#L1-L7
But, this permission must be configured in a ClusterRole and in my case, with OpenShift namespace isolation, each project has has its own prometheus with a simple Role and I can't add this rule (nonResourceURLs).
So, it is not applicable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants