Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VMAgent config is not generated properly then attach_metadata is set. #697

Closed
0megam opened this issue Jul 21, 2023 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@0megam
Copy link

0megam commented Jul 21, 2023

HI.
I'm using this VMServiceScrape resource to scrape data from node-exporter service:

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMServiceScrape
metadata:
  labels:
    app.kubernetes.io/instance: victoria-metrics-k8s-stack
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: victoria-metrics-k8s-stack
    app.kubernetes.io/version: v1.91.3
    argocd.argoproj.io/instance: victoria-metrics-k8s-stack
    helm.sh/chart: victoria-metrics-k8s-stack-0.17.0
  name: victoria-metrics-k8s-stack-node-exporter
  namespace: victoria-metrics
spec:
  endpoints:
  - attach_metadata:
      node: true
    metricRelabelConfigs:
    - action: drop
      regex: /var/lib/kubelet/pods.+
      source_labels:
      - mountpoint
    port: metrics
  jobLabel: jobLabel
  selector:
    matchLabels:
      app.kubernetes.io/name: prometheus-node-exporter

VM operator generates following job configuration for VMagent:

- job_name: serviceScrape/victoria-metrics/victoria-metrics-k8s-stack-node-exporter/0
  honor_labels: false
  kubernetes_sd_configs:
  - role: endpoints
    attach_metadata:
      node: "true"
    namespaces:
      names:
      - victoria-metrics
  relabel_configs:
  ....

Looks like operator converting boolean true to string.
VMAgent fails to read this config:

2023-07-21T23:08:20.718Z	info	VictoriaMetrics/lib/promscrape/scraper.go:114	reading Prometheus configs from "/etc/vmagent/config_out/vmagent.env.yaml"
2023-07-21T23:08:20.723Z	fatal	VictoriaMetrics/lib/promscrape/scraper.go:117	cannot read "/etc/vmagent/config_out/vmagent.env.yaml": cannot parse Prometheus config from "/etc/vmagent/config_out/vmagent.env.yaml": cannot unmarshal data: yaml: unmarshal errors:
  line 368: cannot unmarshal !!str `true` into bool; pass -promscrape.config.strictParse=false command-line flag for ignoring unknown fields in yaml config
@0megam 0megam changed the title vmagent config is not generated properly then attach_metadata is set. VMAgent config is not generated properly then attach_metadata is set. Jul 21, 2023
@Haleygo
Copy link
Contributor

Haleygo commented Jul 22, 2023

Thanks for report!

@Haleygo Haleygo added the bug Something isn't working label Jul 22, 2023
@Amper
Copy link
Contributor

Amper commented Aug 25, 2023

Fixed at v0.36.0 release

@Amper Amper closed this as completed Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants