helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

[prometheus-kube-stack] additionalScrapeConfigs got error

Open marknguyen85 opened this issue 2 years ago • 5 comments

Describe the bug a clear and concise description of what the bug is.

I created and run succeed but when add the additional scrape configs to the values.yaml file

additionalScrapeConfigs:
      — job_name: postgres-exporter
        metrics_path: /pgmaster
        static_configs:
          — targets: 
            - http://192.168.1.12:9187

then run a command

helm -n monitoring upgrade prometheus -f values.yaml prometheus-community/kube-prometheus-stack

and display an error

Error: failed to parse values.yaml: error converting YAML to JSON: yaml: line 2501: mapping values are not allowed in this context
helm.go:88: [debug] error converting YAML to JSON: yaml: line 2501: mapping values are not allowed in this context
failed to parse values.yaml
helm.sh/helm/v3/pkg/cli/values.(*Options).MergeValues
        helm.sh/helm/v3/pkg/cli/values/options.go:54
main.newUpgradeCmd.func2
        helm.sh/helm/v3/cmd/helm/upgrade.go:145
github.com/spf13/cobra.(*Command).execute
        github.com/spf13/[email protected]/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
        github.com/spf13/[email protected]/command.go:974
github.com/spf13/cobra.(*Command).Execute
        github.com/spf13/[email protected]/command.go:902
main.main
        helm.sh/helm/v3/cmd/helm/helm.go:87
runtime.main
        runtime/proc.go:225
runtime.goexit
        runtime/asm_amd64.s:1371

Noted: the line 2501 is the static_configs keyword

Please give me a advise for this, thanks

What's your helm version?

version.BuildInfo{Version:"v3.7.2", GitCommit:"663a896f4a815053445eec4153677ddc24a0a361", GitTreeState:"clean", GoVersion:"go1.16.10"}

What's your 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:"24", GitVersion:"v1.24.1", GitCommit:"3ddd0f45aa91e2f30c70734b175631bec5b5825a", GitTreeState:"clean", BuildDate:"2022-05-24T12:26:19Z", GoVersion:"go1.18.2", Compiler:"gc", Platform:"linux/amd64"} Kustomize Version: v4.5.4 Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.9", GitCommit:"9dd794e454ac32d97cde41ae10be801ae98f75df", GitTreeState:"clean", BuildDate:"2021-03-18T01:00:06Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"} WARNING: version difference between client (1.24) and server (1.19) exceeds the supported minor version skew of +/-1

Which chart?

prometheus-kube-stack

What's the chart version?

latest

Enter the changed values of values.yaml?

additionalScrapeConfigs:
      — job_name: postgres-exporter
        metrics_path: /pgmaster
        static_configs:
          — targets: 
            - http://192.168.1.12:9187

Enter the command that you execute and failing/misfunctioning.

kube-prometheus-stack]$ helm -n monitoring upgrade prometheus -f values.yaml prometheus-community/kube-prometheus-stack --debug

marknguyen85 avatar Jun 14 '22 06:06 marknguyen85

try this:

additionalScrapeConfigs:
  - job_name: 'postgres-exporter'
    metrics_path: /pgmaster
    static_configs:
      - targets: ['http://192.168.1.12:9187']

alyabievgy avatar Jun 14 '22 09:06 alyabievgy

try this:

additionalScrapeConfigs:
  - job_name: postgres-exporter
    metrics_path: /pgmaster
    static_configs:
      - targets: ['http://192.168.1.12:9187']

still got errors

marknguyen85 avatar Jun 14 '22 10:06 marknguyen85

Any help me?

marknguyen85 avatar Jun 25 '22 10:06 marknguyen85

Use extraScrapeConfigs instead of additionalScrapeConfigs:

extraScrapeConfigs: |
  - job_name: postgres-exporter
    metrics_path: /pgmaster
    static_configs:
    - targets: ['http://192.168.1.12:9187']

b3r4t avatar Jul 04 '22 12:07 b3r4t

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 Aug 10 '22 04:08 stale[bot]

This issue is being automatically closed due to inactivity.

stale[bot] avatar Sep 20 '22 18:09 stale[bot]