2022-05-31 17:40:49 +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: civo
|
|
|
|
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
|
|
|
|
- job_name: kubernetes-service-endpoints
|
|
|
|
kubernetes_sd_configs:
|
|
|
|
- role: endpoints
|
|
|
|
relabel_configs:
|
|
|
|
- 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
|
2022-10-26 16:35:32 +00:00
|
|
|
- action: replace
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_endpoint_port_name
|
|
|
|
target_label: kubernetes_endpoint_port_name
|
2022-05-31 17:40:49 +00:00
|
|
|
- action: replace
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_pod_node_name
|
|
|
|
target_label: kubernetes_node
|
|
|
|
- job_name: kubernetes-pods
|
|
|
|
kubernetes_sd_configs:
|
|
|
|
- role: pod
|
|
|
|
relabel_configs:
|
|
|
|
- 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
|
2022-10-26 16:35:32 +00:00
|
|
|
- action: replace
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_pod_container_port_name
|
|
|
|
target_label: kubernetes_port_name
|
2022-05-31 17:40:49 +00:00
|
|
|
- action: drop
|
|
|
|
regex: Pending|Succeeded|Failed
|
|
|
|
source_labels:
|
|
|
|
- __meta_kubernetes_pod_phase
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
2022-06-02 20:16:51 +00:00
|
|
|
name: vmagent
|
|
|
|
namespace: monitoring
|
2022-05-31 17:40:49 +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-05-31 17:40:49 +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
|
2023-09-19 03:10:50 +00:00
|
|
|
image: "victoriametrics/vmagent:v1.93.5"
|
2022-05-31 17:40:49 +00:00
|
|
|
imagePullPolicy: "IfNotPresent"
|
|
|
|
args:
|
2022-06-02 20:16:51 +00:00
|
|
|
- -remoteWrite.url=http://vmcluster.proxy-civo.svc/insert/0/prometheus/
|
2022-05-31 17:40:49 +00:00
|
|
|
- -remoteWrite.showURL
|
|
|
|
- -promscrape.config=/config/prometheus.yml
|
|
|
|
volumeMounts:
|
|
|
|
- name: config-volume
|
|
|
|
mountPath: /config
|
|
|
|
volumes:
|
|
|
|
- name: config-volume
|
|
|
|
configMap:
|
|
|
|
name: vmagent
|
|
|
|
---
|