Skip to content

Instantly share code, notes, and snippets.

@erangaeb
Last active December 3, 2022 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erangaeb/f2e760c31c7755594031a91713b4bd20 to your computer and use it in GitHub Desktop.
Save erangaeb/f2e760c31c7755594031a91713b4bd20 to your computer and use it in GitHub Desktop.
service monitor to probe k8s services via blackbox exporter
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: blackbox-exporter
spec:
endpoints:
- interval: 1m
path: /probe
scrapeTimeout: 10s
params:
module: [tcp_prober]
relabelings:
- sourceLabels: [__address__]
targetLabel: __param_target
- targetLabel: __address__
replacement: black-prometheus-blackbox-exporter:9115 # is the name:port of the blackbox exporter service
- sourceLabels: [__param_target]
targetLabel: instance
- action: labelmap
regex: __meta_kubernetes_service_label_(.+) # specify to monitor kubernets services
jobLabel: blackbox-exporter
selector:
matchLabels:
app.kubernetes.io/component: blackbox # monitor the services only with this label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment