I'm new to Prometheus, so I'm not sure what I'm doing wrong but these are my service and service monitor definitions.
apiVersion: v1
kind: Service
metadata:
name: jenkins
annotations:
prometheus.io/scrape: 'true'
prometheus.io/port: '8080'
prometheus.io/path: '/prometheus'
labels:
app.kubernetes.io/instance: jenkins
app.kubernetes.io/component: jenkins
spec:
type: ClusterIP
ports:
- port: 8080
targetPort: 8080
selector:
app: jenkins
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: jenkins
labels:
app.kubernetes.io/instance: jenkins
app.kubernetes.io/component: jenkins
release: prometheus
spec:
endpoints:
- interval: 10s
path: /prometheus/
port: "8080"
jobLabel: app.kubernetes.io/instance
selector:
matchLabels:
app.kubernetes.io/component: jenkins
app.kubernetes.io/instance: jenkins
But my Jenkins doesn't appear under the targets list on the Prometheus UI.
It appears under Service Discovery which makes me believe that the Operator is correctly picking it up through the release: prometheus label.
I have installed the prometheus plugin on jenkins and I'm able to view metrics when I curl https://<JENKINS_URL>/prometheus/
What I'm trying to figure out is why Jenkins doesn't appear under the targets list.
Is there any proper documentation on how to go about this or can anyone who has successfully implemented this share any pointers?