Skip to content

6. cluster monitoring

老夫的猫呢 edited this page Aug 16, 2024 · 6 revisions

prometheus

global:
  scrape_interval: 15s
  scrape_timeout: 10s
  evaluation_interval: 15s
alerting:
  alertmanagers:
    - follow_redirects: true
      enable_http2: true
      scheme: http
      timeout: 10s
      api_version: v2
      static_configs:
        - targets: []
scrape_configs:
  - job_name: etcd
    honor_timestamps: true
    scrape_interval: 15s
    scrape_timeout: 10s
    metrics_path: /metrics
    scheme: http
    static_configs:
      - targets:
          - 172.16.115.11:2381
          - 172.16.115.12:2381
          - 172.16.115.13:2381
        labels:
          cluster: demo

  - job_name: kube-controller-manager
    honor_timestamps: true
    scrape_interval: 15s
    scrape_timeout: 10s
    metrics_path: /metrics
    scheme: https
    authorization:
      type: Bearer
      credentials_file: /etc/prometheus/conf.d/demo/token
    tls_config:
      insecure_skip_verify: true
    follow_redirects: true
    enable_http2: true
    static_configs:
      - targets:
          - 172.16.115.11:10257
          - 172.16.115.12:10257
          - 172.16.115.13:10257
        labels:
          cluster: demo

  - job_name: kube-apiserver
    honor_timestamps: true
    scrape_interval: 15s
    scrape_timeout: 10s
    metrics_path: /metrics
    scheme: https
    authorization:
      type: Bearer
      credentials_file: /etc/prometheus/conf.d/demo/token
    tls_config:
      insecure_skip_verify: true
    follow_redirects: true
    enable_http2: true
    static_configs:
      - targets:
          - 172.16.115.11:6443
          - 172.16.115.12:6443
          - 172.16.115.13:6443
        labels:
          cluster: demo

  - job_name: kube-scheduler
    honor_timestamps: true
    scrape_interval: 15s
    scrape_timeout: 10s
    metrics_path: /metrics
    scheme: https
    authorization:
      type: Bearer
      credentials_file: /etc/prometheus/conf.d/demo/token
    tls_config:
      insecure_skip_verify: true
    follow_redirects: true
    enable_http2: true
    static_configs:
      - targets:
          - 172.16.115.11:10259
          - 172.16.115.12:10259
          - 172.16.115.13:10259
        labels:
          cluster: demo

  - job_name: kube-proxy
    honor_timestamps: true
    scrape_interval: 15s
    scrape_timeout: 10s
    metrics_path: /metrics
    scheme: http
    follow_redirects: true
    enable_http2: true
    static_configs:
      - targets:
          - 172.16.115.11:10249
          - 172.16.115.12:10249
          - 172.16.115.13:10249
          - 172.16.115.14:10249
          - 172.16.115.15:10249
          - 172.16.115.16:10249
        labels:
          cluster: demo

  - job_name: kubelet
    honor_timestamps: true
    scrape_interval: 15s
    scrape_timeout: 10s
    metrics_path: /metrics
    scheme: https
    authorization:
      type: Bearer
      credentials_file: /etc/prometheus/conf.d/demo/token
    tls_config:
      insecure_skip_verify: true
    follow_redirects: true
    enable_http2: true
    static_configs:
      - targets:
          - 172.16.115.11:10250
          - 172.16.115.12:10250
          - 172.16.115.13:10250
          - 172.16.115.14:10250
          - 172.16.115.15:10250
          - 172.16.115.16:10250
        labels:
          cluster: demo

  - job_name: kube-state-metrics
    honor_timestamps: true
    metrics_path: /metrics
    scheme: http
    static_configs:
      - targets:
          - 172.16.115.11:32555
        labels:
          cluster: demo

  - job_name: fluent
    honor_timestamps: true
    metrics_path: /api/v1/metrics/prometheus
    scheme: http
    static_configs:
      - targets:
          - 172.16.115.11:3000
        labels:
          cluster: demo

Grafana dashboard ID:

Kubernetes / API server: 12116

Kubernetes / Controller Manager: 12122

Kubernetes / Scheduler: 12130

Kubernetes / Proxy: 12129

Kubernetes / Kubelet: 12123

Kubernetes / kube-state-metrics: 747 16520

Kubernetes / Calico 3244

Kubernetes Cluster: 15208

Clone this wiki locally