server-configmap.yaml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. ---
  2. # Source: loki-stack/charts/prometheus/templates/server-configmap.yaml
  3. apiVersion: v1
  4. kind: ConfigMap
  5. metadata:
  6. labels:
  7. component: "server"
  8. app: prometheus
  9. release: loki
  10. chart: prometheus-9.3.1
  11. heritage: Tiller
  12. name: loki-prometheus-server
  13. data:
  14. alerts: |
  15. groups:
  16. prometheus.yml: |
  17. global:
  18. evaluation_interval: 1m
  19. scrape_interval: 1m
  20. scrape_timeout: 10s
  21. rule_files:
  22. - /etc/config/rules
  23. - /etc/config/alerts
  24. scrape_configs:
  25. - job_name: prometheus
  26. static_configs:
  27. - targets:
  28. - localhost:9090
  29. - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
  30. job_name: kubernetes-apiservers
  31. kubernetes_sd_configs:
  32. - role: endpoints
  33. relabel_configs:
  34. - action: keep
  35. regex: default;kubernetes;https
  36. source_labels:
  37. - __meta_kubernetes_namespace
  38. - __meta_kubernetes_service_name
  39. - __meta_kubernetes_endpoint_port_name
  40. scheme: https
  41. tls_config:
  42. ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
  43. insecure_skip_verify: true
  44. - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
  45. job_name: kubernetes-nodes
  46. kubernetes_sd_configs:
  47. - role: node
  48. relabel_configs:
  49. - action: labelmap
  50. regex: __meta_kubernetes_node_label_(.+)
  51. - replacement: kubernetes.default.svc:443
  52. target_label: __address__
  53. - regex: (.+)
  54. replacement: /api/v1/nodes/$1/proxy/metrics
  55. source_labels:
  56. - __meta_kubernetes_node_name
  57. target_label: __metrics_path__
  58. scheme: https
  59. tls_config:
  60. ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
  61. insecure_skip_verify: true
  62. - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
  63. job_name: kubernetes-nodes-cadvisor
  64. kubernetes_sd_configs:
  65. - role: node
  66. relabel_configs:
  67. - action: labelmap
  68. regex: __meta_kubernetes_node_label_(.+)
  69. - replacement: kubernetes.default.svc:443
  70. target_label: __address__
  71. - regex: (.+)
  72. replacement: /api/v1/nodes/$1/proxy/metrics/cadvisor
  73. source_labels:
  74. - __meta_kubernetes_node_name
  75. target_label: __metrics_path__
  76. scheme: https
  77. tls_config:
  78. ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
  79. insecure_skip_verify: true
  80. - job_name: kubernetes-service-endpoints
  81. kubernetes_sd_configs:
  82. - role: endpoints
  83. relabel_configs:
  84. - action: keep
  85. regex: true
  86. source_labels:
  87. - __meta_kubernetes_service_annotation_prometheus_io_scrape
  88. - action: replace
  89. regex: (https?)
  90. source_labels:
  91. - __meta_kubernetes_service_annotation_prometheus_io_scheme
  92. target_label: __scheme__
  93. - action: replace
  94. regex: (.+)
  95. source_labels:
  96. - __meta_kubernetes_service_annotation_prometheus_io_path
  97. target_label: __metrics_path__
  98. - action: replace
  99. regex: ([^:]+)(?::\d+)?;(\d+)
  100. replacement: $1:$2
  101. source_labels:
  102. - __address__
  103. - __meta_kubernetes_service_annotation_prometheus_io_port
  104. target_label: __address__
  105. - action: labelmap
  106. regex: __meta_kubernetes_service_label_(.+)
  107. - action: replace
  108. source_labels:
  109. - __meta_kubernetes_namespace
  110. target_label: kubernetes_namespace
  111. - action: replace
  112. source_labels:
  113. - __meta_kubernetes_service_name
  114. target_label: kubernetes_name
  115. - action: replace
  116. source_labels:
  117. - __meta_kubernetes_pod_node_name
  118. target_label: kubernetes_node
  119. - honor_labels: true
  120. job_name: prometheus-pushgateway
  121. kubernetes_sd_configs:
  122. - role: service
  123. relabel_configs:
  124. - action: keep
  125. regex: pushgateway
  126. source_labels:
  127. - __meta_kubernetes_service_annotation_prometheus_io_probe
  128. - job_name: kubernetes-services
  129. kubernetes_sd_configs:
  130. - role: service
  131. metrics_path: /probe
  132. params:
  133. module:
  134. - http_2xx
  135. relabel_configs:
  136. - action: keep
  137. regex: true
  138. source_labels:
  139. - __meta_kubernetes_service_annotation_prometheus_io_probe
  140. - source_labels:
  141. - __address__
  142. target_label: __param_target
  143. - replacement: blackbox
  144. target_label: __address__
  145. - source_labels:
  146. - __param_target
  147. target_label: instance
  148. - action: labelmap
  149. regex: __meta_kubernetes_service_label_(.+)
  150. - source_labels:
  151. - __meta_kubernetes_namespace
  152. target_label: kubernetes_namespace
  153. - source_labels:
  154. - __meta_kubernetes_service_name
  155. target_label: kubernetes_name
  156. - job_name: kubernetes-pods
  157. kubernetes_sd_configs:
  158. - role: pod
  159. relabel_configs:
  160. - action: keep
  161. regex: true
  162. source_labels:
  163. - __meta_kubernetes_pod_annotation_prometheus_io_scrape
  164. - action: replace
  165. regex: (.+)
  166. source_labels:
  167. - __meta_kubernetes_pod_annotation_prometheus_io_path
  168. target_label: __metrics_path__
  169. - action: replace
  170. regex: ([^:]+)(?::\d+)?;(\d+)
  171. replacement: $1:$2
  172. source_labels:
  173. - __address__
  174. - __meta_kubernetes_pod_annotation_prometheus_io_port
  175. target_label: __address__
  176. - action: labelmap
  177. regex: __meta_kubernetes_pod_label_(.+)
  178. - action: replace
  179. source_labels:
  180. - __meta_kubernetes_namespace
  181. target_label: kubernetes_namespace
  182. - action: replace
  183. source_labels:
  184. - __meta_kubernetes_pod_name
  185. target_label: kubernetes_pod_name
  186. alerting:
  187. alertmanagers:
  188. - kubernetes_sd_configs:
  189. - role: pod
  190. tls_config:
  191. ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
  192. bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
  193. relabel_configs:
  194. - source_labels: [__meta_kubernetes_namespace]
  195. regex: loki
  196. action: keep
  197. - source_labels: [__meta_kubernetes_pod_label_app]
  198. regex: prometheus
  199. action: keep
  200. - source_labels: [__meta_kubernetes_pod_label_component]
  201. regex: alertmanager
  202. action: keep
  203. - source_labels: [__meta_kubernetes_pod_container_port_number]
  204. regex:
  205. action: drop
  206. rules: |
  207. {}