linkerd / linkerd/linkerd2

Support header for queries from control plane to external prometheus

Open
#5,708 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
Go
Stars
11.5k
Forks
1.4k
Avg merge
3d 22h
Merged PRs (30d)
53

Description

Feature Request

What problem are you trying to solve?

We have an external prometheus server and we deploy prometheus agents to scrap all target pods' metrics inside the cluster and push to remote prometheus. So write should be fine.
But for reading metrics, the clients need to use the API token in the header to query the metrics.
curl -H "Authorization: Bearer ${API_TOKEN}" https://${REMOVE_PROMETHEUS_URL}/api/v1/query

Right now there is no way to add the token to linkerd control plane. https://github.com/linkerd/linkerd2/blob/main/viz/metrics-api/cmd/main.go#L51

How should the problem be solved?

The library that Linkerd is using supports adding headers using RoundTripper https://github.com/prometheus/client_golang/pull/817/files#diff-152f0c0b2d5899f52f5578b6fc8c6d48d3ea8afabb1f7a59b1676c2730298e23R167

What do you want to happen? Add any considered drawbacks.
Expose this token config to the deploy interface.

Any alternatives you've considered?

Is there another way to solve this problem that isn't as good a solution?

How would users interact with this feature?

If you can, explain how users will be able to use this. Maybe some sample CLI
output?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in viz/metrics-api/cmd/main.go and review the referenced prometheus client_golang RoundTripper support. Trace how the control plane's external Prometheus URL is configured and exposed through the deploy interface. Done means users can configure a token and queries include it in the Authorization header.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes, prometheus
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.