Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@peppi-lotta
Copy link

@peppi-lotta peppi-lotta commented Apr 15, 2025

1. Why is this pull request needed?

It adds optional TLS support to the CoreDNS metrics endpoint, allowing metrics to be served over HTTPS. This improves security by encrypting metrics traffic. TLS is disabled by default, so existing configurations continue to work.

2. Related issues

#7109

3. Documentation changes

  • Update metrics plugin docs to include TLS settings and examples
  • Add instructions for providing certificates and configuring Prometheus to scrape over HTTPS
  • Add troubleshooting notes

4. Backward compatibility

No breaking changes. TLS is optional and off by default.

@peppi-lotta peppi-lotta force-pushed the peppi-lotta/metrics-tls-support branch 8 times, most recently from 89c8dbf to 7ac7560 Compare April 15, 2025 10:51
@peppi-lotta
Copy link
Author

@chrisohaver @SuperQ Would you have time to review? :)

@kashifest
Copy link

@chrisohaver @SuperQ can you please take a look on this PR? It would be nice to have this PR moving forward

@codecov
Copy link

codecov bot commented Apr 25, 2025

Codecov Report

❌ Patch coverage is 60.46512% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.19%. Comparing base (93c57b6) to head (8c5515c).
⚠️ Report is 1706 commits behind head on master.

Files with missing lines Patch % Lines
plugin/metrics/setup.go 0.00% 11 Missing and 1 partial ⚠️
plugin/metrics/metrics.go 83.87% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7255      +/-   ##
==========================================
+ Coverage   55.70%   63.19%   +7.49%     
==========================================
  Files         224      278      +54     
  Lines       10016    15129    +5113     
==========================================
+ Hits         5579     9561    +3982     
- Misses       3978     4879     +901     
- Partials      459      689     +230     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kashifest
Copy link

It would be really nice to have someone review this and start the discussion rolling

@amshankaran
Copy link

It would be helpful if someone could take a look at this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof, I'm really not a fan of having this write out a templated yaml file like this.

Maybe we first need to refactor the exporter-toolkit slightly so that you can pass the web.Config struct directly instead of having to use the config file only.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for commenting, I really appreciate it! Is this a blocker for this PR? If so, I'm willing to provide the refactoring PR in exporter-toolkit if needed :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the current way be acceptable as an interim solution so as to secure the metrics endpoint with TLS and meanwhile we improve the exporter-toolkit to include the web.Config as a Struct as suggested and eventually use that here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SuperQ Is this as acceptable as an interim solution? Can this get merged?

@peppi-lotta
Copy link
Author

@jameshartig @miekg @SuperQ @greenpau @Tantalor93 Can I get a review on this? What are the next steps needed to get this merged?

@peppi-lotta peppi-lotta force-pushed the peppi-lotta/metrics-tls-support branch from f12b5dd to ce041ac Compare June 2, 2025 09:06
@miekg
Copy link
Member

miekg commented Jun 19, 2025

I consider TLS on metric endpoints to be an anti feature

@JanMkl
Copy link

JanMkl commented Jun 19, 2025

I consider TLS on metric endpoints to be an anti feature

I understand the desire to minimise complexity—especially on internal metrics endpoints—but in a zero-trust architecture, all network traffic, regardless of source or function, must be both authenticated and encrypted.

Tampering with metrics may seem low-impact, but it can lead to unpredictable or harmful behavior. For example:

  • It can reveal service topology and workload characteristics.
  • It can trigger alerts or automated remediation based on falsified data.

In multi-tenant or regulated environments where the network is not implicitly trusted, TLS is not an anti-feature—it’s a baseline security control. Even when the content isn’t sensitive, preserving integrity and controlling access are essential.

To be clear, the PR does not propose mandatory TLS—it introduces optional support, as indicated in the title: “Add optional TLS support to /metrics endpoint”. Rejecting TLS outright disregards the realities of deployment models built on zero-trust principles.

@peppi-lotta peppi-lotta force-pushed the peppi-lotta/metrics-tls-support branch from ce041ac to 8f81c13 Compare September 22, 2025 09:37
@peppi-lotta peppi-lotta force-pushed the peppi-lotta/metrics-tls-support branch 3 times, most recently from 9239ecc to 2b84a94 Compare October 21, 2025 07:23
@peppi-lotta
Copy link
Author

I've simplified this TLS implementation quite a bit. It's still using the Prometheus exporter-toolkit but now in the intended way. There is no more creating any temp files (this was the concern brought up in this comment: #7255 (comment)).

@jameshartig @miekg @SuperQ @greenpau @Tantalor93 Can I get a review on this? What are the next steps needed to get this merged?

@peppi-lotta peppi-lotta force-pushed the peppi-lotta/metrics-tls-support branch from 2b84a94 to 8c5515c Compare October 27, 2025 11:15
Copy link

@kashifest kashifest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, it looks ok. It would nice to have someone with review rights have a look into this.

@peppi-lotta peppi-lotta force-pushed the peppi-lotta/metrics-tls-support branch 3 times, most recently from 1fbe753 to cd49281 Compare November 11, 2025 08:09
@kashifest
Copy link

@johnbelamaric would you please take a look at this one?

@yongtang
Copy link
Member

yongtang commented Dec 4, 2025

@SuperQ any additional feedback on the updated PR?

@peppi-lotta peppi-lotta force-pushed the peppi-lotta/metrics-tls-support branch from cd49281 to 5c93f42 Compare December 8, 2025 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants