003-prometheus-config.yaml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: prometheus-config
  5. namespace: monitoring
  6. data:
  7. prometheus.yml: |
  8. global:
  9. scrape_configs:
  10. - job_name: 'kubernetes-kubelet'
  11. scheme: https
  12. tls_config:
  13. ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
  14. insecure_skip_verify: true
  15. bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
  16. kubernetes_sd_configs:
  17. - role: node
  18. relabel_configs:
  19. - action: labelmap
  20. regex: __meta_kubernetes_node_label_(.+)
  21. - target_label: __address__
  22. replacement: kubernetes.default.svc.cluster.local:443
  23. - source_labels: [__meta_kubernetes_node_name]
  24. regex: (.+)
  25. target_label: __metrics_path__
  26. replacement: /api/v1/nodes/${1}/proxy/metrics
  27. - job_name: 'kubernetes-cadvisor'
  28. scheme: https
  29. tls_config:
  30. ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
  31. insecure_skip_verify: true
  32. bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
  33. kubernetes_sd_configs:
  34. - role: node
  35. relabel_configs:
  36. - action: labelmap
  37. regex: __meta_kubernetes_node_label_(.+)
  38. - target_label: __address__
  39. replacement: kubernetes.default.svc.cluster.local:443
  40. - source_labels: [__meta_kubernetes_node_name]
  41. regex: (.+)
  42. target_label: __metrics_path__
  43. replacement: /api/v1/nodes/${1}/proxy/metrics/cadvisor
  44. - job_name: 'kubernetes-kube-state'
  45. kubernetes_sd_configs:
  46. - role: pod
  47. relabel_configs:
  48. - action: labelmap
  49. regex: __meta_kubernetes_pod_label_(.+)
  50. - source_labels: [__meta_kubernetes_namespace]
  51. action: replace
  52. target_label: kubernetes_namespace
  53. - source_labels: [__meta_kubernetes_pod_name]
  54. action: replace
  55. target_label: kubernetes_pod_name
  56. - source_labels: [__meta_kubernetes_pod_label_grafanak8sapp]
  57. regex: .*true.*
  58. action: keep
  59. - source_labels: ['__meta_kubernetes_pod_label_daemon', '__meta_kubernetes_pod_node_name']
  60. regex: 'node-exporter;(.*)'
  61. action: replace
  62. target_label: nodename