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: v1 | |
kind: Service | |
metadata: | |
labels: | |
app.kubernetes.io/name: rahasak | |
app.kubernetes.io/component: blackbox | |
name: rahasak | |
spec: | |
clusterIP: None | |
ports: |
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
# run service monitory | |
kubectl apply -f servicemonitor.yaml | |
❯❯ kubectl get servicemonitors | grep blackbox-exporter | |
blackbox-exporter 69m | |
# access prometheus ui via port-forward | |
❯❯ kubectl port-forward svc/prom-kube-prometheus-stack-prometheus 9090:9090 | |
Forwarding from 127.0.0.1:9090 -> 9090 | |
Forwarding from [::1]:9090 -> 9090 |
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
# run nginx | |
kubectl apply -f nginx1.yaml | |
kubectl apply -f nginx2.yaml | |
❯❯ kubectl get pods | grep nginx | |
nginx1 1/1 Running 0 64m | |
nginx2 1/1 Running 0 62m | |
❯❯ kubectl get svc | grep nginx | |
nginx1 LoadBalancer 10.110.184.190 <pending> 80:32198/TCP 65m |
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: v1 | |
kind: Pod | |
metadata: | |
name: nginx2 | |
labels: | |
app: nginx2 | |
app.kubernetes.io/component: blackbox | |
spec: | |
containers: | |
- name: nginx2 |
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: v1 | |
kind: Pod | |
metadata: | |
name: nginx1 | |
labels: | |
app: nginx1 | |
app.kubernetes.io/component: blackbox | |
spec: | |
containers: | |
- name: nginx1 |
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: |
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
prometheus: | |
prometheusSpec: | |
serviceMonitorNamespaceSelector: {} # get service monitors on all namespaces | |
serviceMonitorSelectorNilUsesHelmValues: false | |
ruleSelectorNilUsesHelmValues: false | |
ruleNamespaceSelector: {} | |
serviceMonitorSelector: {} # get all existing service monitors |
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
# add helm repository | |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts | |
helm repo update | |
# install prometheus with helm chart | |
helm install prom prometheus-community/kube-prometheus-stack --values values-prometheus.yaml | |
# running pods | |
# chart installs additional, dependent charts | |
# - prometheus-community/kube-state-metrics |
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
# add helm repository | |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts | |
helm repo update | |
# install blackbox exporter with values file | |
helm install black prometheus-community/prometheus-blackbox-exporter --values values-blackbox.yaml | |
# running pods | |
❯❯ kubectl get pods | |
NAME READY STATUS RESTARTS AGE |
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
config: | |
modules: | |
tcp_prober: | |
prober: tcp | |
tcp: | |
ip_protocol_fallback: false | |
preferred_ip_protocol: ip4 |