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 - job_name: kubernetes-service-endpoints kubernetes_sd_configs: - role: endpoints relabel_configs: - action: drop source_labels: [__meta_kubernetes_pod_container_init] regex: true - 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 - job_name: kubernetes-pods kubernetes_sd_configs: - role: pod relabel_configs: - action: drop source_labels: [__meta_kubernetes_pod_container_init] regex: true - 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 - job_name: 'node-exporter' kubernetes_sd_configs: - role: endpoints relabel_configs: - source_labels: [__meta_kubernetes_endpoints_name] regex: 'prometheus-node-exporter' action: keep --- apiVersion: apps/v1 kind: Deployment metadata: name: vmagent namespace: monitoring labels: app.kubernetes.io/name: victoria-metrics app.kubernetes.io/component: agent annotations: configmap.reloader.stakater.com/reload: "vmagent" 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 image: "victoriametrics/vmagent:v1.106.1" imagePullPolicy: "IfNotPresent" args: - -remoteWrite.url=http://vmcluster.auth-proxy.svc/insert/0/prometheus/ - -remoteWrite.showURL - -promscrape.config=/config/prometheus.yml - -promscrape.suppressDuplicateScrapeTargetErrors volumeMounts: - name: config-volume mountPath: /config volumes: - name: config-volume configMap: name: vmagent ---