"Fossies" - the Fresh Open Source Software Archive

Member "lens-5.2.4/extensions/metrics-cluster-feature/resources/02-configmap.yml.hb" (23 Sep 2021, 9583 Bytes) of package /linux/misc/lens-5.2.4.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 apiVersion: v1
    2 kind: ConfigMap
    3 metadata:
    4   name: prometheus-config
    5   namespace: lens-metrics
    6 data:
    7   prometheus.yaml: |-
    8     # Global config
    9     global:
   10       scrape_interval: 15s
   11 
   12     {{#if alertManagers}}
   13     # AlertManager
   14     alerting:
   15       alertmanagers:
   16       - static_configs:
   17         - targets:
   18           {{#each alertManagers}}
   19           - {{this}}
   20           {{/each}}
   21     {{/if}}
   22 
   23     # Scrape configs for running Prometheus on a Kubernetes cluster.
   24     # This uses separate scrape configs for cluster components (i.e. API server, node)
   25     # and services to allow each to use different authentication configs.
   26     #
   27     # Kubernetes labels will be added as Prometheus labels on metrics via the
   28     # `labelmap` relabeling action.
   29     scrape_configs:
   30 
   31     # Scrape config for API servers.
   32     #
   33     # Kubernetes exposes API servers as endpoints to the default/kubernetes
   34     # service so this uses `endpoints` role and uses relabelling to only keep
   35     # the endpoints associated with the default/kubernetes service using the
   36     # default named port `https`. This works for single API server deployments as
   37     # well as HA API server deployments.
   38     - job_name: 'kubernetes-apiservers'
   39       kubernetes_sd_configs:
   40       - role: endpoints
   41 
   42       scheme: https
   43       tls_config:
   44         ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
   45         # Using endpoints to discover kube-apiserver targets finds the pod IP
   46         # (host IP since apiserver uses host network) which is not used in
   47         # the server certificate.
   48         insecure_skip_verify: true
   49       bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
   50 
   51       # Keep only the default/kubernetes service endpoints for the https port. This
   52       # will add targets for each API server which Kubernetes adds an endpoint to
   53       # the default/kubernetes service.
   54       relabel_configs:
   55       - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
   56         action: keep
   57         regex: default;kubernetes;https
   58       - replacement: apiserver
   59         action: replace
   60         target_label: job
   61 
   62     # Scrape config for node (i.e. kubelet) /metrics (e.g. 'kubelet_'). Explore
   63     # metrics from a node by scraping kubelet (127.0.0.1:10250/metrics).
   64     - job_name: 'kubelet'
   65       kubernetes_sd_configs:
   66       - role: node
   67 
   68       scheme: https
   69       tls_config:
   70         ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
   71         # Kubelet certs don't have any fixed IP SANs
   72         insecure_skip_verify: true
   73       bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
   74 
   75       relabel_configs:
   76       - action: labelmap
   77         regex: __meta_kubernetes_node_label_(.+)
   78       - replacement: 'lens-metrics'
   79         target_label: kubernetes_namespace
   80 
   81       metric_relabel_configs:
   82       - source_labels:
   83           - namespace
   84         action: replace
   85         regex: (.+)
   86         target_label: kubernetes_namespace
   87 
   88     # Scrape config for Kubelet cAdvisor. Explore metrics from a node by
   89     # scraping kubelet (127.0.0.1:10250/metrics/cadvisor).
   90     - job_name: 'kubernetes-cadvisor'
   91       kubernetes_sd_configs:
   92       - role: node
   93 
   94       scheme: https
   95       metrics_path: /metrics/cadvisor
   96       tls_config:
   97         # Kubelet certs don't have any fixed IP SANs
   98         insecure_skip_verify: true
   99         ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
  100       bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
  101 
  102       relabel_configs:
  103       - action: labelmap
  104         regex: __meta_kubernetes_node_label_(.+)
  105       metric_relabel_configs:
  106       - source_labels:
  107           - namespace
  108         action: replace
  109         target_label: kubernetes_namespace
  110       - source_labels:
  111         - pod
  112         regex: (.*)
  113         replacement: $1
  114         action: replace
  115         target_label: pod_name
  116       - source_labels:
  117         - container
  118         regex: (.*)
  119         replacement: $1
  120         action: replace
  121         target_label: container_name
  122 
  123     # Scrap etcd metrics from masters via etcd-scraper-proxy
  124     - job_name: 'etcd'
  125       kubernetes_sd_configs:
  126       - role: pod
  127       scheme: http
  128       relabel_configs:
  129         - source_labels: [__meta_kubernetes_namespace]
  130           action: keep
  131           regex: 'kube-system'
  132         - source_labels: [__meta_kubernetes_pod_label_component]
  133           action: keep
  134           regex: 'etcd-scraper-proxy'
  135         - action: labelmap
  136           regex: __meta_kubernetes_pod_label_(.+)
  137 
  138     # Scrape config for service endpoints.
  139     #
  140     # The relabeling allows the actual service scrape endpoint to be configured
  141     # via the following annotations:
  142     #
  143     # * `prometheus.io/scrape`: Only scrape services that have a value of `true`
  144     # * `prometheus.io/scheme`: If the metrics endpoint is secured then you will need
  145     # to set this to `https` & most likely set the `tls_config` of the scrape config.
  146     # * `prometheus.io/path`: If the metrics path is not `/metrics` override this.
  147     # * `prometheus.io/port`: If the metrics are exposed on a different port to the
  148     # service then set this appropriately.
  149     - job_name: 'kubernetes-service-endpoints'
  150 
  151       kubernetes_sd_configs:
  152       - role: endpoints
  153         namespaces:
  154           names:
  155             - lens-metrics
  156 
  157       relabel_configs:
  158       - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape]
  159         action: keep
  160         regex: true
  161       - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme]
  162         action: replace
  163         target_label: __scheme__
  164         regex: (https?)
  165       - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path]
  166         action: replace
  167         target_label: __metrics_path__
  168         regex: (.+)
  169       - source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port]
  170         action: replace
  171         target_label: __address__
  172         regex: ([^:]+)(?::\d+)?;(\d+)
  173         replacement: $1:$2
  174       - action: labelmap
  175         regex: __meta_kubernetes_service_label_(.+)
  176       - source_labels: [__meta_kubernetes_service_name]
  177         action: replace
  178         target_label: job
  179       - action: replace
  180         source_labels:
  181         - __meta_kubernetes_pod_node_name
  182         target_label: kubernetes_node
  183       - source_labels: [__meta_kubernetes_namespace]
  184         action: replace
  185         target_label: kubernetes_namespace
  186       metric_relabel_configs:
  187       - source_labels:
  188           - namespace
  189         action: replace
  190         regex: (.+)
  191         target_label: kubernetes_namespace
  192 
  193     # Example scrape config for probing services via the Blackbox Exporter.
  194     #
  195     # The relabeling allows the actual service scrape endpoint to be configured
  196     # via the following annotations:
  197     #
  198     # * `prometheus.io/probe`: Only probe services that have a value of `true`
  199     - job_name: 'kubernetes-services'
  200 
  201       metrics_path: /probe
  202       params:
  203         module: [http_2xx]
  204 
  205       kubernetes_sd_configs:
  206       - role: service
  207         namespaces:
  208           names:
  209             - lens-metrics
  210 
  211       relabel_configs:
  212       - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_probe]
  213         action: keep
  214         regex: true
  215       - source_labels: [__address__]
  216         target_label: __param_target
  217       - target_label: __address__
  218         replacement: blackbox
  219       - source_labels: [__param_target]
  220         target_label: instance
  221       - action: labelmap
  222         regex: __meta_kubernetes_service_label_(.+)
  223       - source_labels: [__meta_kubernetes_service_name]
  224         target_label: job
  225       metric_relabel_configs:
  226       - source_labels:
  227           - namespace
  228         action: replace
  229         regex: (.+)
  230         target_label: kubernetes_namespace
  231 
  232     # Example scrape config for pods
  233     #
  234     # The relabeling allows the actual pod scrape endpoint to be configured via the
  235     # following annotations:
  236     #
  237     # * `prometheus.io/scrape`: Only scrape pods that have a value of `true`
  238     # * `prometheus.io/path`: If the metrics path is not `/metrics` override this.
  239     # * `prometheus.io/port`: Scrape the pod on the indicated port instead of the
  240     # pod's declared ports (default is a port-free target if none are declared).
  241     - job_name: 'kubernetes-pods'
  242 
  243       kubernetes_sd_configs:
  244       - role: pod
  245         namespaces:
  246           names:
  247             - lens-metrics
  248 
  249       relabel_configs:
  250       - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
  251         action: keep
  252         regex: true
  253       - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
  254         action: replace
  255         target_label: __metrics_path__
  256         regex: (.+)
  257       - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
  258         action: replace
  259         regex: ([^:]+)(?::\d+)?;(\d+)
  260         replacement: $1:$2
  261         target_label: __address__
  262       - action: labelmap
  263         regex: __meta_kubernetes_pod_label_(.+)
  264       - source_labels: [__meta_kubernetes_namespace]
  265         action: replace
  266         target_label: kubernetes_namespace
  267       - source_labels: [__meta_kubernetes_pod_name]
  268         action: replace
  269         target_label: kubernetes_pod_name
  270       metric_relabel_configs:
  271       - source_labels:
  272           - namespace
  273         action: replace
  274         regex: (.+)
  275         target_label: kubernetes_namespace
  276 
  277     # Rule files
  278     rule_files:
  279       - "/etc/prometheus/rules/*.rules"
  280       - "/etc/prometheus/rules/*.yaml"
  281       - "/etc/prometheus/rules/*.yml"