prometheus-operator / kube-prometheus

Use Prometheus to monitor Kubernetes and applications running on Kubernetes

Home Page:https://prometheus-operator.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Grafana DataSources hard code kube-prometheus

TimothySutton81 opened this issue · comments

What happened?
I genereated kube-prometheus using a custom jsonnet file, and set the name of prometheus to be k3s instead of defaulted k8s. I deployed everything and noticed my Grafana dashboard was not loading data sources successfully. I then realized it was still using http://prometheus-k8s.monitoring.svc:9090 url, but my service was named prometheus-k3s. I went and found the manifests/grafana-dashboardDatasources.yaml file and updated it to k3s name and data appeared in my dashboards.

Here is a section of the jsonnet config:

values+:: {
      common+: {
        namespace: 'monitoring',
      },
       prometheus+:: {

        namespaces: ["default", "kube-system", "monitoring"],
        name: 'k3s',
      },
    },

Did you expect to see some different?

Yes as describe above.

How to reproduce it (as minimally and precisely as possible):
Ran these commands to build kube-prometheus deployment

jb init # Creates the initial/empty jsonnetfile.json
jb install github.com/prometheus-operator/kube-prometheus/jsonnet/kube-prometheus@main
wget https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/main/build.sh -O build.sh
chmod +x build.sh
./build.sh ims_kube_prometheus.jsonnet

Environment

Oracle Linux

  • Prometheus Operator version:

  • Kubernetes version information:
    kubectl version
    WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version.
    Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.4", GitCommit:"fa3d7990104d7c1f16943a67f11b154b71f6a132", GitTreeState:"clean", BuildDate:"2023-07-19T12:20:54Z", GoVersion:"go1.20.6", Compiler:"gc", Platform:"linux/amd64"}
    Kustomize Version: v5.0.1
    Server Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.7+k3s2", GitCommit:"575bce7689f4be112bd0099362fb8d5f2e39398e", GitTreeState:"clean", BuildDate:"2023-11-08T02:32:49Z", GoVersion:"go1.20.10", Compiler:"gc", Platform:"linux/amd64"}

  • Kubernetes cluster kind:
    k3s

  • Manifests:

  • Prometheus Operator Logs:

  • Prometheus Logs:

Anything else we need to know?: