VictoriaMetrics / operator

Kubernetes operator for Victoria Metrics
Apache License 2.0
422 stars 140 forks source link

The VMServiceScrape "vmoperator-demo" is invalid: spec.endpoints: Required value #853

Closed willzhang closed 7 months ago

willzhang commented 7 months ago

The official docs need to be update:https://docs.victoriametrics.com/operator/quick-start.html#vmservicescrape

For instance, we can create vmservicescrape for VictoriaMetrics operator manually. Let's create file vmservicescrape.yaml:

code vmservicescrape.yaml

with the following content:

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMServiceScrape
metadata:
  name: vmoperator-demo
spec:
  selector:
    matchLabels:
      app.kubernetes.io/instance: vmoperator
      app.kubernetes.io/name: victoria-metrics-operator
  namespaceSelector: 
    matchNames:
      - vm

After that you can deploy vmservicescrape resource to the kubernetes cluster:

kubectl apply -f vmservicescrape.yaml -n vm

error logs

root@ubuntu:~/test# kubectl -n vm apply -f vmservicescrape.yaml 
The VMServiceScrape "vmoperator-demo" is invalid: spec.endpoints: Required value

it need spec.endpoints: https://github.com/VictoriaMetrics/operator/blob/master/config/examples/vmservicescrape.yaml

# cat vmservicescrape.yaml 
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMServiceScrape
metadata:
  name: example-scrape
spec:
  endpoints:
    - port: http
  namespaceSelector: {}
  selector:
    matchLabels:
      app.kubernetes.io/name: example-application
      monitored-by: vm-operator
Haleygo commented 7 months ago

Thanks for reporting! Should be fixed in https://github.com/VictoriaMetrics/operator/pull/843