k0sproject / k0s

k0s - The Zero Friction Kubernetes
https://docs.k0sproject.io
Other
3.63k stars 360 forks source link

Prometheus is enabled using annotations by default on most components #3165

Closed rmannibucau closed 1 month ago

rmannibucau commented 1 year ago

Before creating an issue, make sure you've checked the following:

Platform

Not important (rh8)

Version

1.2.26 - but master has it too

Sysinfo

`k0s sysinfo`
➡️ Please replace this text with the output of `k0s sysinfo`. ⬅️

What happened?

prometheus annotations enable scraping for kube-system components (https://github.com/k0sproject/k0s/blob/73a8a11d56c8e0c7535f45c22f9739440c12635e/pkg/component/controller/kubeproxy.go#L312), would be great to make it togglable and deactivable for instances where prometheus is not intended for core components, in particular when it does not work out of the box cause the node ip is not accessible to prometheus for ex.

Steps to reproduce

Start k0s (in single node mode for ex) .

Expected behavior

Check annotations of coredns, kube-proxy and kube-router, should get scrape=false for prometheus default setup

Actual behavior

scrape=true

Screenshots and logs

-

Additional context

-

jnummelin commented 1 year ago

@rmannibucau Just to make sure I got it right, you'd want to have some config toggle to enable/disable k0s setting up prometheus.io/scrape: annotation value?

rmannibucau commented 1 year ago

@jnummelin yes, ideally in k0s.yaml or alike.

alessiodionisi commented 1 year ago

I've found prometheus.io/scrape: true annotation in these components:

I propose to add a boolean configuration under each component called prometheusScrapeAnnotation which by default will be true (for backwards compatibility).

Example k0s.yaml:

apiVersion: k0s.k0sproject.io/v1beta1
kind: ClusterConfig
metadata:
  name: k0s
spec:
  ...
  coredns:
    prometheusScrapeAnnotation: true
  konnectivity:
    ...
    prometheusScrapeAnnotation: true
  network:
    ...
    kubeProxy:
      ...
      prometheusScrapeAnnotation: true
    kuberouter:
      ...
      prometheusScrapeAnnotation: true

WDYT?

rmannibucau commented 1 year ago

Looks perfect to me! Thank you very much.

alessiodionisi commented 1 year ago

I'm working on it.

github-actions[bot] commented 1 year ago

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] commented 1 year ago

The issue is marked as stale since no activity has been recorded in 30 days

rmannibucau commented 1 year ago

Can we reopen it, guess it is just a bot thing?

github-actions[bot] commented 1 year ago

The issue is marked as stale since no activity has been recorded in 30 days

rmannibucau commented 1 year ago

Up?

github-actions[bot] commented 11 months ago

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] commented 10 months ago

The issue is marked as stale since no activity has been recorded in 30 days

rmannibucau commented 10 months ago

Up

github-actions[bot] commented 9 months ago

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] commented 8 months ago

The issue is marked as stale since no activity has been recorded in 30 days

alessiodionisi commented 6 months ago

@twz123 can you reopen this issue? The PR is ready to review

github-actions[bot] commented 5 months ago

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] commented 3 months ago

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] commented 2 months ago

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] commented 1 month ago

The issue is marked as stale since no activity has been recorded in 30 days