Prometheus-operator: Service monitor CRD does not affect adding job scrape

Created on 19 Nov 2018  路  3Comments  路  Source: prometheus-operator/prometheus-operator

I have created service monitor resource

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: pushgateway
  namespace: monitoring
spec:
  endpoints:
  - interval: 30s
    port: http
  jobLabel: pushgateway
  namespaceSelector:
    matchNames:
    - monitoring
  selector:
    matchLabels:
      app: prometheus-pushgateway

I have not see any changes in prometheus.yaml

k get secret prometheus-kube-prometheus -ojson | jq -r '.data["prometheus.yaml"]' | base64 -D | grep pushgateway | wc -l
       0

I tried to remove operator pod but it is still not working

Besides your "troubleshoting" is not really troubleshoting, cause you don't give us any receipt to fix it, only shell command to see that problem is really exist :(

https://github.com/coreos/prometheus-operator/blob/master/Documentation/troubleshooting.md#troubleshooting-servicemonitor-changes

Prometheus operator version is 0.20.0
Helm chart version is 0.0.29

Most helpful comment

@ev4ern awesome, I'm glad the fix was simple. This again underscores the need for improving our documentation, error detection, and trouble shooting.

All 3 comments

@ev4ern I suspect that your Prometheus Operator is not selecting your new ServiceMonitor because the labels on the monitor do not match the labels in your Prometheus object's spec.serviceMonitor.serviceMonitorSelector.matchLabels. Can you please share the yaml for the actual Prometheus resource, e.g. kubectl get prometheus -n monitoring -o yaml?

Regarding the troubleshooting of ServiceMonitors, we've found this is a very common pain point for users and are prioritizing making this easier to debug and harder to get wrong in the first place.

Oh:( Thats my fail

You right!!!

Thanks!

@ev4ern awesome, I'm glad the fix was simple. This again underscores the need for improving our documentation, error detection, and trouble shooting.

Was this page helpful?
0 / 5 - 0 ratings