Code Monkey home page Code Monkey logo

Comments (7)

toporek3112 avatar toporek3112 commented on September 25, 2024 1

Yess, thank you that's working.
Lessons learned: next time just look at the CRD's :)
Sorry for bothering
BR

from charts.

juan131 avatar juan131 commented on September 25, 2024

Hi @toporek3112

Does your ServiceMonitor looks like this?

$ helm template kube-prometheus oci://registry-1.docker.io/bitnamicharts/kube-prometheus -f custom-values.yaml -s templates/exporters/kubelet/servicemonitor.yaml
Pulled: registry-1.docker.io/bitnamicharts/kube-prometheus:9.2.1
Digest: sha256:61e0fcee27d9f84a7beb25b33d459eef104ef2e806c180cc7e5b3aad3f610cd4
---
# Source: kube-prometheus/templates/exporters/kubelet/servicemonitor.yaml
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: kube-prometheus-kubelet
  namespace: "default"
  labels:
    app.kubernetes.io/instance: kube-prometheus
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: kube-prometheus
    app.kubernetes.io/version: 0.74.0
    helm.sh/chart: kube-prometheus-9.2.1
    app.kubernetes.io/component: kubelet
spec:
  jobLabel: k8s-app
  selector:
    matchLabels:
      k8s-app: kubelet
  namespaceSelector:
    matchNames:
      - kube-system
  endpoints:
    - port: https-metrics
      scheme: https
      tlsConfig:
        caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
        serverName: kubernetes
        insecureSkipVerify: true
      bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
      honorLabels: true
      relabelings:
        - action: replace
          replacement: ${labelCluster}
          target_label: cluster
    - port: https-metrics
      scheme: https
      path: /metrics/cadvisor
      honorLabels: true
      tlsConfig:
        caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
        serverName: kubernetes
        insecureSkipVerify: true
      bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token

from charts.

toporek3112 avatar toporek3112 commented on September 25, 2024

So I tried applying it again where my values.yaml was:

kubelet:
  enabled: true
  namespace: namespace
  serviceMonitor:
    https: true
    interval: ""
    relabelings:
      - action: replace
        replacement: ${labelCluster}
        target_label: cluster

and the deployed serviceMonitor yaml was:

    relabelings:
    - action: replace
      replacement: [The actual value of ${labelCluster}]

Besides that the serviceMonitor looks same as yours. I don't understand why the target_label key is missing in the serviceMonitor. What am I doing wrong? Or is it a bug of some sort? Idk if it helps but I'm using terraform to deploy this helm chart and the terraform preview is also showing me the correct config like:

kubelet:
  enabled: true
  namespace: namespace
  serviceMonitor:
    https: true
    interval: ""
    relabelings:
      - action: replace
        replacement: [The actual value of ${labelCluster}]
        target_label: cluster

from charts.

toporek3112 avatar toporek3112 commented on September 25, 2024

I also would have a different question. Is there a way to configure appending a label to all scraped metrics/alle jobs? Like maybe in the global section? But how to configure it for the helm chart?

from charts.

toporek3112 avatar toporek3112 commented on September 25, 2024

Today I also was trying to configure this but it seems not to work...
https://github.com/bitnami/charts/blob/kube-prometheus/8.17.1/bitnami/kube-prometheus/templates/prometheus/prometheus.yaml#L62

from charts.

juan131 avatar juan131 commented on September 25, 2024

Hi @toporek3112

Besides that the serviceMonitor looks same as yours. I don't understand why the target_label key is missing in the serviceMonitor. What am I doing wrong? Or is it a bug of some sort?

It should be targetLabel instead of target_label according to the CRD:

from charts.

juan131 avatar juan131 commented on September 25, 2024

I'm glad it worked, proceeding to close the issue. Feel free to reopen it if you require further assistance

from charts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.