2022-04-14 10:07:25 +00:00
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
metadata:
|
|
|
|
name: vmagent
|
|
|
|
namespace: monitoring
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: victoria-metrics
|
|
|
|
app.kubernetes.io/component: agent
|
|
|
|
data:
|
|
|
|
prometheus.yml: |
|
|
|
|
global:
|
|
|
|
scrape_interval: 1m
|
|
|
|
external_labels:
|
|
|
|
source: scaleway
|
|
|
|
agent: vmagent
|
|
|
|
scrape_configs:
|
|
|
|
- job_name: 'vmagent'
|
|
|
|
static_configs:
|
|
|
|
- targets: ['localhost:8429']
|
|
|
|
- bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
|
|
|
|
job_name: kubernetes-nodes
|
|
|
|
kubernetes_sd_configs:
|
|
|
|
- role: node
|
|
|
|
relabel_configs:
|
|
|
|
- action: labelmap
|
|
|
|
regex: __meta_kubernetes_node_label_(.+)
|
|
|
|
- replacement: kubernetes.default.svc:443
|
|
|
|
target_label: __address__
|
|
|
|
- regex: (.+)
|
|
|
|
replacement: /api/v1/nodes/$1/proxy/metrics
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_node_name
|
|
|
|
target_label: __metrics_path__
|
|
|
|
scheme: https
|
|
|
|
tls_config:
|
|
|
|
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
|
|
|
|
insecure_skip_verify: true
|
2022-07-14 18:22:44 +00:00
|
|
|
|
2022-04-14 10:07:25 +00:00
|
|
|
- job_name: kubernetes-service-endpoints
|
|
|
|
kubernetes_sd_configs:
|
|
|
|
- role: endpoints
|
|
|
|
relabel_configs:
|
2022-07-14 18:22:44 +00:00
|
|
|
- action: drop
|
|
|
|
source_labels: [__meta_kubernetes_pod_container_init]
|
|
|
|
regex: true
|
2022-04-14 10:07:25 +00:00
|
|
|
- action: keep
|
|
|
|
regex: true
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_service_annotation_prometheus_io_scrape
|
|
|
|
- action: replace
|
|
|
|
regex: (https?)
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_service_annotation_prometheus_io_scheme
|
|
|
|
target_label: __scheme__
|
|
|
|
- action: replace
|
|
|
|
regex: (.+)
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_service_annotation_prometheus_io_path
|
|
|
|
target_label: __metrics_path__
|
|
|
|
- action: replace
|
|
|
|
regex: ([^:]+)(?::\d+)?;(\d+)
|
|
|
|
replacement: $1:$2
|
|
|
|
source_labels:
|
|
|
|
- __address__
|
|
|
|
- __meta_kubernetes_service_annotation_prometheus_io_port
|
|
|
|
target_label: __address__
|
|
|
|
- action: labelmap
|
|
|
|
regex: __meta_kubernetes_service_label_(.+)
|
|
|
|
- action: replace
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_namespace
|
|
|
|
target_label: kubernetes_namespace
|
|
|
|
- action: replace
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_service_name
|
|
|
|
target_label: kubernetes_name
|
|
|
|
- action: replace
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_pod_node_name
|
|
|
|
target_label: kubernetes_node
|
2022-07-14 18:22:44 +00:00
|
|
|
|
2022-04-14 10:07:25 +00:00
|
|
|
- job_name: kubernetes-pods
|
|
|
|
kubernetes_sd_configs:
|
|
|
|
- role: pod
|
|
|
|
relabel_configs:
|
2022-07-14 18:22:44 +00:00
|
|
|
- action: drop
|
|
|
|
source_labels: [__meta_kubernetes_pod_container_init]
|
|
|
|
regex: true
|
2022-04-14 10:07:25 +00:00
|
|
|
- action: keep
|
|
|
|
regex: true
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_pod_annotation_prometheus_io_scrape
|
|
|
|
- action: replace
|
|
|
|
regex: (.+)
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_pod_annotation_prometheus_io_path
|
|
|
|
target_label: __metrics_path__
|
|
|
|
- action: replace
|
|
|
|
regex: ([^:]+)(?::\d+)?;(\d+)
|
|
|
|
replacement: $1:$2
|
|
|
|
source_labels:
|
|
|
|
- __address__
|
|
|
|
- __meta_kubernetes_pod_annotation_prometheus_io_port
|
|
|
|
target_label: __address__
|
|
|
|
- action: labelmap
|
|
|
|
regex: __meta_kubernetes_pod_label_(.+)
|
|
|
|
- action: replace
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_namespace
|
|
|
|
target_label: kubernetes_namespace
|
|
|
|
- action: replace
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_pod_name
|
|
|
|
target_label: kubernetes_pod_name
|
|
|
|
- action: drop
|
|
|
|
regex: Pending|Succeeded|Failed
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_pod_phase
|
|
|
|
|
2022-07-14 18:22:44 +00:00
|
|
|
- job_name: 'node-exporter'
|
|
|
|
kubernetes_sd_configs:
|
|
|
|
- role: endpoints
|
|
|
|
relabel_configs:
|
|
|
|
- source_labels: [__meta_kubernetes_endpoints_name]
|
|
|
|
regex: 'prometheus-node-exporter'
|
|
|
|
action: keep
|
2022-04-14 10:07:25 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
2022-06-02 20:16:51 +00:00
|
|
|
name: vmagent
|
|
|
|
namespace: monitoring
|
2022-04-14 10:07:25 +00:00
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: victoria-metrics
|
|
|
|
app.kubernetes.io/component: agent
|
2022-06-02 20:16:51 +00:00
|
|
|
annotations:
|
|
|
|
configmap.reloader.stakater.com/reload: "vmagent"
|
2022-04-14 10:07:25 +00:00
|
|
|
spec:
|
|
|
|
strategy:
|
|
|
|
type: Recreate
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app.kubernetes.io/name: victoria-metrics
|
|
|
|
app.kubernetes.io/component: agent
|
|
|
|
replicas: 1
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: victoria-metrics
|
|
|
|
app.kubernetes.io/component: agent
|
|
|
|
spec:
|
|
|
|
serviceAccountName: prometheus-server
|
|
|
|
containers:
|
|
|
|
- name: vmagent
|
2024-04-26 03:02:34 +00:00
|
|
|
image: "victoriametrics/vmagent:v1.101.0"
|
2022-04-14 10:07:25 +00:00
|
|
|
imagePullPolicy: "IfNotPresent"
|
|
|
|
args:
|
2022-06-02 20:16:51 +00:00
|
|
|
- -remoteWrite.url=http://vmcluster.auth-proxy.svc/insert/0/prometheus/
|
2022-04-14 10:07:25 +00:00
|
|
|
- -remoteWrite.showURL
|
|
|
|
- -promscrape.config=/config/prometheus.yml
|
2022-07-14 18:22:44 +00:00
|
|
|
- -promscrape.suppressDuplicateScrapeTargetErrors
|
2022-04-14 10:07:25 +00:00
|
|
|
volumeMounts:
|
|
|
|
- name: config-volume
|
|
|
|
mountPath: /config
|
|
|
|
volumes:
|
|
|
|
- name: config-volume
|
|
|
|
configMap:
|
|
|
|
name: vmagent
|
|
|
|
---
|