charts icon indicating copy to clipboard operation
charts copied to clipboard

[stable/prometheus-operator] The additionalScrapeConfigsSecret seems to have a bug and doesn't work

Open drmy opened this issue 6 years ago • 3 comments

Describe the bug

Issue 1)

I failed to helm install the 9.1.0 version of stable/prometheus-operator. I created a local installation manifest yaml file as below. I pre-created a secret in the same namespace and want to use the existing secret for the prometheus-operator install.

prometheus: service: type: NodePort nodePort: "30090" prometheusSpec: additionalScrapeConfigsSecret: enabled: true name: my-prometheus-scrape-config key: additional-scrape-configs.yaml alertmanager: service: type: NodePort nodePort: "30093"

However, the install was always failed with the following error:

Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(Prometheus.spec.additionalScrapeConfigs): invalid type for com.coreos.monitoring.v1.Prometheus.spec.additionalScrapeConfigs: got "string", expected "map"

After some investigation, I successfully fixed the installation issue by modifying the official file prometheus.yaml inside the prometheus-operator helm chart: I downloaded the file prometheus-operator-9.1.0.tgz by running helm pull stable/prometheus-operator --version 9.1.0 I edited the file prometheus-operator/templates/prometheus/prometheus.yaml In the line 214 and 215, I replaced the string {{- with {{ , meaning remove the character "-"., updated to be:

{{- if .Values.prometheus.prometheusSpec.additionalScrapeConfigsSecret.enabled }} additionalScrapeConfigs: name: {{ .Values.prometheus.prometheusSpec.additionalScrapeConfigsSecret.name }} key: {{ .Values.prometheus.prometheusSpec.additionalScrapeConfigsSecret.key }} {{- end }}

After that I can successfully installed. So it looks like a bug in the helm chart?

Issue 2)

Even though I can successfully install I failed to open the prometheus: http://10.222.42.90:30090/targets

I found that once I reinstall the prometheus-operator by disabling the prometheusSpec.additionalScrapeConfigsSecret.enabled in my manifest I can open the prometheus UI. I have no idea what's wrong with my usage on the existing the scrape configs secret.

This is my file called additional-scrape-configs.yaml **- job_name: rabbitmq_exporter scrape_interval: 10s scrape_timeout: 10s metrics_path: /metrics scheme: http static_configs: - targets: ["10.222.42.90:15692"]

  • job_name: redis_exporter scrape_interval: 10s scrape_timeout: 10s metrics_path: /metrics scheme: http static_configs:
    • targets: ["10.222.42.90:18685"]**

I just use this commnad to create the secret: kubectl create secret generic igt-prometheus-scrape-config -n monitoring --from-file=additional-scrape-configs.yaml

The prometheus-operator was also installed in the same namespace monitoring. helm install prometheus-operator prometheus-operator --version 9.1.0 -n monitoring -f prometheus-operator-install-manifest.yaml

Could you please help me the two issues? Thank you very much!

Version of Helm and Kubernetes: 1.18.4

Which chart: stable/prometheus-operator

drmy avatar Jul 20 '20 09:07 drmy

Also experiencing this issue:

level=info ts=2020-08-05T19:16:44.359458492Z caller=operator.go:1094 component=prometheusoperator msg="sync prometheus" key=monitoring/prom-prometheus-operator-prometheus
E0805 19:16:44.430924       1 operator.go:994] Sync "monitoring/prom-prometheus-operator-prometheus" failed: creating config failed: generating config failed: unmarshalling additional scrape configs failed: yaml: unmarshal errors:
  line 1: cannot unmarshal !!str `LSBqb2J...` into []yaml.MapSlice

EDIT: This is unrelated, I double base64 encoded the secret value.

owenmonagan avatar Aug 05 '20 20:08 owenmonagan

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

stale[bot] avatar Sep 05 '20 19:09 stale[bot]

🚧 This chart is now deprecated.

Further development has moved to prometheus-community/helm-charts. The chart has been renamed kube-prometheus-stack to more clearly reflect that it installs the kube-prometheus project stack, within which Prometheus Operator is only one component.

If applicable, please re-open this issue there. Thanks!

scottrigby avatar Sep 09 '20 21:09 scottrigby