I've Installed kube-prometheus-stack through helm chart. Need to add additional scrape configs for prometheus. Created a configmap to scrape the metrics from grok-exporter
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus
data:
prometheus.yml: |-
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'grok'
static_configs:
- targets: ['grok-exporter:9144']
Applied this configmap. Then created the secret from this configmap using the below command
""kubectl create secret generic grok-prometheus --from-file=grok-prometheus.yaml"
Secret is created. Then Added additionalScrapeConfigSecrets in the values.yaml of kube-prometheus-stack.
additionalScrapeConfigsSecret:
enabled: true
name: grok-prometheus
key: grok-prometheus.yaml
After this upgraded the helmchart
when I check the "kubectl get prometheus -o yaml" able to see the additionalScrapeConfigs are added.
spec:
additionalScrapeConfigs:
key: grok-prometheus.yaml
name: grok-prometheus
But I got the below error in prometheus output.
- lastTransitionTime: "2022-07-30T16:45:41Z"
message: |-
creating config failed: generating config failed: generate additional scrape configs: unmarshalling additional scrape configs failed: yaml: unmarshal errors:
line 1: cannot unmarshal !!map into []yaml.MapSlice
reason: ReconciliationFailed
status: "False"
type: Reconciled
Can anyone help me with this. Thanks in advance.