Last active
December 3, 2022 18:16
-
-
Save erangaeb/f2e760c31c7755594031a91713b4bd20 to your computer and use it in GitHub Desktop.
service monitor to probe k8s services via blackbox exporter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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