-
When I create the following servicemonitor, it adds a duplicate job to the apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: pihole-prometheus-servicemonitor
namespace: cattle-monitoring-system
labels:
name: pihole-prometheus-servicemonitor
release: kube-monitoring
spec:
selector:
matchLabels:
app.kubernetes.io/instance: pihole-exporter
app.kubernetes.io/name: pihole-exporter
namespaceSelector:
matchNames:
- cattle-monitoring-system
endpoints:
- port: metrics
- path: /metrics From inside the prometheus pod: /etc/prometheus/config_out $ cat prometheus.env.yaml | grep pihole
- job_name: serviceMonitor/cattle-monitoring-system/pihole-prometheus-servicemonitor/0
regex: (pihole-exporter);true
regex: (pihole-exporter);true
- job_name: serviceMonitor/cattle-monitoring-system/pihole-prometheus-servicemonitor/1
regex: (pihole-exporter);true
regex: (pihole-exporter);true At first I thought this was because perhaps one was already there before I created the servicemonitor, but when I deleted the servicemonitor again, both jobs were removed from the yaml file. I had trouble getting this to work, so I have been deleting/recreating the servicemonitor a few times, perhaps that has something to do with it? What's causing this? In case required, the service itself: apiVersion: v1
kind: Service
metadata:
name: pihole-exporter
namespace: cattle-monitoring-system
labels:
app.kubernetes.io/name: pihole-exporter
app.kubernetes.io/instance: pihole-exporter
spec:
ports:
- protocol: TCP
name: metrics
port: 9617
selector:
app.kubernetes.io/name: pihole-exporter
app.kubernetes.io/instance: pihole-exporter |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I've not solved it yet, but I did find that it is probably not related to me deleting/recreating the servicemonitor. I uninstalled the chart and removed the namespace it was in, after recreating the namespace and reinstalling the chart, the issue persists. |
Beta Was this translation helpful? Give feedback.
-
Ahh I got it. Yaml formatting of course... In my servicemonitor, I had the following: endpoints:
- port: metrics
- path: /metrics where it should have been: endpoints:
- port: metrics
path: /metrics |
Beta Was this translation helpful? Give feedback.
Ahh I got it. Yaml formatting of course...
In my servicemonitor, I had the following:
where it should have been: