io.yupiik.alveoli:prometheus-simple:1.0.28-SNAPSHOT
Prometheus local/dev setup. Will be available on http://$(PROMETHEUS_SERVICE_SERVICE_HOST):$(PROMETHEUS_SERVICE_SERVICE_PORT).
Maven Dependency
<dependency>
<groupId>io.yupiik.alveoli</groupId>
<artifactId>prometheus-simple</artifactId>
<version>1.0.28-SNAPSHOT</version>
</dependency>
Default Configuration
- prometheus.yml
global:
scrape_interval: {{prometheus-simple.scrape_internal:-{{prometheus-simple.internal:-5s}}}}
evaluation_interval: {{prometheus-simple.evaluation_interval:-{{prometheus-simple.internal:-5s}}}}
rule_files:
- /etc/prometheus/prometheus.rules
alerting:
alertmanagers:
- scheme: http
static_configs:
- targets:
- "alertmanager.monitoring.svc:9093"
scrape_configs:
- job_name: 'kubernetes-apiservers'
kubernetes_sd_configs:
- role: endpoints
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
relabel_configs:
- source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
action: keep
regex: default;kubernetes;https
- job_name: 'kubernetes-nodes'
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
kubernetes_sd_configs:
- role: node
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
- target_label: __address__
replacement: kubernetes.default.svc:443
- source_labels: [__meta_kubernetes_node_name]
regex: (.+)
target_label: __metrics_path__
replacement: /api/v1/nodes/${1}/proxy/metrics
- job_name: 'kubernetes-pods'
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep
regex: true
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
action: replace
target_label: __metrics_path__
regex: (.+)
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
action: replace
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:$2
target_label: __address__
- action: labelmap
regex: __meta_kubernetes_pod_label_(.+)
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: kubernetes_namespace
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: kubernetes_pod_name
- job_name: 'kube-state-metrics'
static_configs:
- targets: ['kube-state-metrics.kube-system.svc.cluster.local:8080']
- job_name: 'kubernetes-cadvisor'
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
kubernetes_sd_configs:
- role: node
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
- target_label: __address__
replacement: kubernetes.default.svc:443
- source_labels: [__meta_kubernetes_node_name]
regex: (.+)
target_label: __metrics_path__
replacement: /api/v1/nodes/${1}/proxy/metrics/cadvisor
- job_name: 'kubernetes-service-endpoints'
kubernetes_sd_configs:
- role: endpoints
relabel_configs:
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape]
action: keep
regex: true
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme]
action: replace
target_label: __scheme__
regex: (https?)
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path]
action: replace
target_label: __metrics_path__
regex: (.+)
- source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port]
action: replace
target_label: __address__
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:$2
- action: labelmap
regex: __meta_kubernetes_service_label_(.+)
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: kubernetes_namespace
- source_labels: [__meta_kubernetes_service_name]
action: replace
target_label: kubernetes_name
Ports
-
Name:
prometheus
-
Protocol: TCP
-
Port: 9090
-
Target Port: 9090
-
Node Port: 32090
-
Tip
|
on linux and with minikube you can access this service using http://$(minikube ip):32090 on your host.
|
Sample Usage
{
"alveoli": [
{
"//": "My alveolus.",
"name": "com.company:my-app:1.0.0",
"descriptors": [],
"dependencies": [
{
"name": "io.yupiik.alveoli:prometheus-simple:1.0.28-SNAPSHOT",
"location": "io.yupiik.alveoli:prometheus-simple:1.0.28-SNAPSHOT",
}
],
"patches": [{
"descriptorName": "io.yupiik.alveoli:prometheus-simple:1.0.28-SNAPSHOT",
"interpolate": true
}]
}
]
}
Configuration
- prometheus-simple.evaluation_interval
-
Default evaluation interval in prometheus configuration. Default value: ``.
- prometheus-simple.image
-
The image to use. Default value:
prom/prometheus:v2.37.0
. - prometheus-simple.internal
-
Default for evaluation and scrape interval in prometheus configuration if not overridden by the specific placeholders. Default value:
5s
. - prometheus-simple.namespace
-
The Kubernetes namespace to use for the installation. Default value: ``.
- prometheus-simple.resources.limits.cpu
-
The resource limits cpu for Prometheus. Default value:
0.2
. - prometheus-simple.resources.limits.memory
-
The resource limits memory for Prometheus. Default value:
128Mi
. - prometheus-simple.resources.requests.cpu
-
The resource requests cpu for Prometheus. Default value:
0.1
. - prometheus-simple.resources.requests.memory
-
The resource requests memory for Prometheus. Default value:
64Mi
. - prometheus-simple.scrape_internal
-
Default scrape interval in prometheus configuration. Default value: ``.
- prometheus-simple.serviceaccount
-
Name of prometheus service account - where cluster role will be bound. Note that we use default by default for simplicity but in a real cluster it can make sense to create a dedicated service account.. Default value:
default
.