Skip to content

Commit c318eda

Browse files
committed
Merge branch 'prometheus-operator-kube-prometheus' into metrics-kafka-minion
2 parents 5fc33f4 + f848f56 commit c318eda

File tree

9 files changed

+109
-3
lines changed

9 files changed

+109
-3
lines changed

prometheus/kustomization.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
bases:
2-
- ../kafka
3-
# or any variant with kafka included, such as
2+
# This kustomization needs to depend on one with kafka in it, to add the sidecar,
3+
# but it needs to be the kafka from the chosen variant, as ../kafka here would override other kustomizations
4+
#- ../kafka
45
#- ../variants/scale-1
56
resources:
67
- 10-metrics-config.yml
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Used from ../prometheus-operator as alternative to installing only the operator and its CRDs
2+
# because we need a stack on which to test monitoring addons
3+
bases:
4+
- github.com/coreos/kube-prometheus?ref=3a64636
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: Prometheus
4+
metadata:
5+
name: k8s
6+
namespace: monitoring
7+
spec:
8+
additionalScrapeConfigs:
9+
# github.com/kubernetes-sigs/kustomize/blob/master/examples/kvSourceGoPlugin.md is clearly WIP
10+
name: additional-scrape-configs-5m4c7m6mc9
11+
# See https://github.com/prometheus/prometheus/pull/4131, and upon disagreement see https://github.com/prometheus/prometheus/issues/4484
12+
key: pods-discovery-by-prometheus-io-annotations.yaml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: monitoring.coreos.com/v1
2+
kind: Alertmanager
3+
metadata:
4+
name: main
5+
namespace: monitoring
6+
spec:
7+
replicas: 1
Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
11
bases:
2-
- ../../prometheus
2+
# The ../../prometheus base must be edited to point to the chosen kafka base
3+
#- ../../prometheus
34
- ../../consumers-prometheus
5+
# Resources won't apply without a prior apply -k with for example one of:
6+
#- github.com/coreos/prometheus-operator?ref=de9a6e1
7+
#- ../prometheus-operator-baseexample
8+
# TEMP:
9+
- ../../../unhelm/kube-prometheus
410
resources:
511
- k8s-kafka-rbac.yaml
612
# with base ../../prometheus
713
- k8s-kafka-servicemonitor.yaml
814
# with base ../../consumers-prometheus
915
- k8s-minion-servicemonitor.yaml
16+
patchesStrategicMerge:
17+
- prometheus-k8s-scale-1.yaml
18+
- prometheus-k8s-2.9.2.yaml
19+
- alertmanager-main-scale-1.yaml
20+
- prometheus-k8s-nodeport.yaml
21+
- additional-scrape-configs.yaml
22+
secretGenerator:
23+
- name: additional-scrape-configs
24+
namespace: monitoring
25+
#kvSources:
26+
#- name: pods-discovery-by-prometheus-io-annotations.yaml
27+
#pluginType: builtin
28+
#args:
29+
#- scrape-configs/pods-discovery-by-prometheus-io-annotations.yaml
30+
files:
31+
- scrape-configs/pods-discovery-by-prometheus-io-annotations.yaml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: monitoring.coreos.com/v1
2+
kind: Prometheus
3+
metadata:
4+
name: k8s
5+
namespace: monitoring
6+
spec:
7+
baseImage: quay.io/prometheus/prometheus
8+
version: v2.7.2
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: prometheus-k8s
5+
namespace: monitoring
6+
spec:
7+
type: NodePort
8+
ports:
9+
- port: 9090
10+
nodePort: 32490
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: monitoring.coreos.com/v1
2+
kind: Prometheus
3+
metadata:
4+
name: k8s
5+
namespace: monitoring
6+
spec:
7+
replicas: 1
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Example scrape config for pods
2+
#
3+
# The relabeling allows the actual pod scrape endpoint to be configured via the
4+
# following annotations:
5+
#
6+
# * `prometheus.io/scrape`: Only scrape pods that have a value of `true`
7+
# * `prometheus.io/path`: If the metrics path is not `/metrics` override this.
8+
# * `prometheus.io/port`: Scrape the pod on the indicated port instead of the
9+
# pod's declared ports (default is a port-free target if none are declared).
10+
- job_name: 'kubernetes-pods'
11+
12+
kubernetes_sd_configs:
13+
- role: pod
14+
15+
relabel_configs:
16+
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
17+
action: keep
18+
regex: true
19+
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
20+
action: replace
21+
target_label: __metrics_path__
22+
regex: (.+)
23+
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
24+
action: replace
25+
regex: ([^:]+)(?::\d+)?;(\d+)
26+
replacement: $1:$2
27+
target_label: __address__
28+
- action: labelmap
29+
regex: __meta_kubernetes_pod_label_(.+)
30+
- source_labels: [__meta_kubernetes_namespace]
31+
action: replace
32+
target_label: kubernetes_namespace
33+
- source_labels: [__meta_kubernetes_pod_name]
34+
action: replace
35+
target_label: kubernetes_pod_name

0 commit comments

Comments
 (0)