about summary refs log tree commit diff
path: root/tools/monitoring/values.yaml
diff options
context:
space:
mode:
authormakefunstuff <[email protected]>2024-06-28 19:40:46 +0200
committermakefunstuff <[email protected]>2024-06-28 19:40:46 +0200
commit791dfea63286a3f8cd23f8058c788c26fc25f99c (patch)
treee781a596abfbdc5291bf9f3bad01879541c090e4 /tools/monitoring/values.yaml
parentd98a6fc8e4d75b079f3700aa87ddc5ab4860e770 (diff)
downloadk3s-lab-791dfea63286a3f8cd23f8058c788c26fc25f99c.tar.gz
more metrics
Diffstat (limited to '')
-rw-r--r--tools/monitoring/values.yaml116
1 files changed, 111 insertions, 5 deletions
diff --git a/tools/monitoring/values.yaml b/tools/monitoring/values.yaml
index dad522e..6ccc866 100644
--- a/tools/monitoring/values.yaml
+++ b/tools/monitoring/values.yaml
@@ -34,7 +34,7 @@ grafana:
           jsonData:
             esVersion: 7
             timeField: "@timestamp"
-
+            
 prometheus:
   alertmanager:
     enabled: true
@@ -42,6 +42,100 @@ prometheus:
     enabled: true
   server:
     enabled: true
+    extraScrapeConfigs:
+      - 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
+            target_label: __address__
+            regex: ([^:]+)(?::\d+)?;(\d+)
+            replacement: $1:$2
+          - 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: 'kubernetes-nodes'
+        kubernetes_sd_configs:
+          - role: node
+        relabel_configs:
+          - action: labelmap
+            regex: __meta_kubernetes_node_label_(.+)
+
+      - job_name: 'kubernetes-apiservers'
+        kubernetes_sd_configs:
+          - role: endpoints
+            namespaces:
+              names:
+                - default
+        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-cadvisor'
+        kubernetes_sd_configs:
+          - role: node
+        scheme: https
+        tls_config:
+          ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
+          insecure_skip_verify: true
+        bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
+        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: node
+          - source_labels: [__meta_kubernetes_node_name]
+            regex: (.+)
+            target_label: instance
+          - 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
 
 elasticsearch:
   volumeClaimTemplate:
@@ -61,13 +155,26 @@ opentelemetry-collector:
         protocols:
           grpc: {}
           http: {}
+      k8s_logs:
+        operators:
+          - type: extract
+            config:
+              from: kubernetes.annotations
     processors:
       batch: {}
+      resource:
+        attributes:
+          - key: k8s.pod.name
+            from_attribute: k8s.pod.uid
+          - key: k8s.namespace.name
+            from_attribute: k8s.namespace.uid
     exporters:
       prometheusremotewrite:
         endpoint: "http://prometheus-server.monitoring.svc.cluster.local/api/v1/write"
       logging:
         loglevel: debug
+      otlphttp:
+        endpoint: "http://elasticsearch-master.monitoring.svc.cluster.local:9200"
     service:
       pipelines:
         metrics:
@@ -75,7 +182,6 @@ opentelemetry-collector:
           processors: [batch]
           exporters: [prometheusremotewrite]
         logs:
-          receivers: [otlp]
-          processors: [batch]
-          exporters: [logging]
-
+          receivers: [otlp, k8s_logs]
+          processors: [batch, resource]
+          exporters: [logging, otlphttp]