11 kubernetes 監(jiān)控(二)

prometheus 監(jiān)控集群

部署 prometheus

創(chuàng)建對(duì)應(yīng)的 ServiceAccount

vim 13-3-prometheus-k8s-ServiceAccount.yml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: prometheus
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: prometheus
subjects:
- kind: ServiceAccount
  name: prometheus-k8s
  namespace: monitoring
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: prometheus
rules:
- apiGroups: [""]
  resources:
  - nodes
  - nodes/proxy
  - services
  - endpoints
  - pods
  verbs: ["get", "list", "watch"]
- apiGroups: [""]
  resources:
  - configmaps
  verbs: ["get"]
- nonResourceURLs: ["/metrics"]
  verbs: ["get"]
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: prometheus-k8s
  namespace: monitoring

kubectl apply -f 13-3-prometheus-k8s-ServiceAccount.yml

創(chuàng)建配置相關(guān)的 configmap

vim 13-3-prometheus-config-configmap.yml
apiVersion: v1
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: prometheus-core
  namespace: monitoring
data:
  prometheus.yaml: |
    global:
      scrape_interval: 10s
      scrape_timeout: 10s
      evaluation_interval: 10s
    rule_files:
      - "/etc/prometheus-rules/*.rules"
    scrape_configs:
      - job_name: 'kubernetes-nodes'
        scheme: https
        tls_config:
          ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
        bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
        kubernetes_sd_configs:
          - role: node
        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: __metrics_path__
          replacement: /api/v1/nodes/${1}/proxy/metrics
      - job_name: 'kubernetes-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

      - job_name: 'kubernetes-services'
        metrics_path: /probe
        params:
          module: [http_2xx]
        kubernetes_sd_configs:
          - role: service
        relabel_configs:
          - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_probe]
            action: keep
            regex: true
          - source_labels: [__address__]
            target_label: __param_target
          - target_label: __address__
            replacement: blackbox
          - source_labels: [__param_target]
            target_label: instance
          - action: labelmap
            regex: __meta_kubernetes_service_label_(.+)
          - source_labels: [__meta_kubernetes_namespace]
            target_label: kubernetes_namespace
          - source_labels: [__meta_kubernetes_service_name]
            target_label: kubernetes_name

      - 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
            regex: (.+):(?:\d+);(\d+)
            replacement: ${1}:${2}
            target_label: __address__
          - 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
          - source_labels: [__meta_kubernetes_pod_container_port_number]
            action: keep
            regex: 9\d{3}

      - job_name: 'kubernetes-cadvisor'
        scheme: https
        tls_config:
          ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
        bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
        kubernetes_sd_configs:
          - role: node
        relabel_configs:
          - action: labelmap
          - action: labelmap
            regex: __meta_kubernetes_node_label_(.+)
          - target_label: __address__
            replacement: kubernetes.default.svc:443
          - source_labels: [__meta_kubernetes_node_name]
            regex: (.+)
            target_label: __metrics_path__
            replacement: /api/v1/nodes/${1}/proxy/metrics/cadvisor

kubectl apply -f 13-3-prometheus-config-configmap.yml

創(chuàng)建告警規(guī)則相關(guān)的 configmap

vim 13-3-prometheus-rules-configmap.yml
apiVersion: v1
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: prometheus-rules
  namespace: monitoring
data:
  cpu-usage.rules: |
    ALERT NodeCPUUsage
      IF (100 - (avg by (instance) (irate(node_cpu{name="node-exporter",mode="idle"}[5m])) * 100)) > 75
      FOR 2m
      LABELS {
        severity="page"
      }
      ANNOTATIONS {
        SUMMARY = "{{$labels.instance}}: High CPU usage detected",
        DESCRIPTION = "{{$labels.instance}}: CPU usage is above 75% (current value is: {{ $value }})"
      }
  instance-availability.rules: |
    ALERT InstanceDown
      IF up == 0
      FOR 1m
      LABELS { severity = "page" }
      ANNOTATIONS {
        summary = "Instance {{ $labels.instance }} down",
        description = "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 1 minute.",
      }
  low-disk-space.rules: |
    ALERT NodeLowRootDisk
      IF ((node_filesystem_size{mountpoint="/root-disk"} - node_filesystem_free{mountpoint="/root-disk"} ) / node_filesystem_size{mountpoint="/root-disk"} * 100) > 75
      FOR 2m
      LABELS {
        severity="page"
      }
      ANNOTATIONS {
        SUMMARY = "{{$labels.instance}}: Low root disk space",
        DESCRIPTION = "{{$labels.instance}}: Root disk usage is above 75% (current value is: {{ $value }})"
      }

    ALERT NodeLowDataDisk
      IF ((node_filesystem_size{mountpoint="/data-disk"} - node_filesystem_free{mountpoint="/data-disk"} ) / node_filesystem_size{mountpoint="/data-disk"} * 100) > 75
      FOR 2m
      LABELS {
        severity="page"
      }
      ANNOTATIONS {
        SUMMARY = "{{$labels.instance}}: Low data disk space",
        DESCRIPTION = "{{$labels.instance}}: Data disk usage is above 75% (current value is: {{ $value }})"
      }
  mem-usage.rules: |
    ALERT NodeSwapUsage
      IF (((node_memory_SwapTotal-node_memory_SwapFree)/node_memory_SwapTotal)*100) > 75
      FOR 2m
      LABELS {
        severity="page"
      }
      ANNOTATIONS {
        SUMMARY = "{{$labels.instance}}: Swap usage detected",
        DESCRIPTION = "{{$labels.instance}}: Swap usage usage is above 75% (current value is: {{ $value }})"
      }

    ALERT NodeMemoryUsage
      IF (((node_memory_MemTotal-node_memory_MemFree-node_memory_Cached)/(node_memory_MemTotal)*100)) > 75
      FOR 2m
      LABELS {
        severity="page"
      }
      ANNOTATIONS {
        SUMMARY = "{{$labels.instance}}: High memory usage detected",
        DESCRIPTION = "{{$labels.instance}}: Memory usage is above 75% (current value is: {{ $value }})"
      }

kubectl apply -f 13-3-prometheus-rules-configmap.yml

創(chuàng)建用戶名和密碼

vim 13-3-prometheus-secret.yml
apiVersion: v1
kind: Secret
data:
  admin-password: YWRtaW4=
  admin-username: YWRtaW4=
metadata:
  name: grafana
  namespace: monitoring
type: Opaque

kubectl apply -f 13-3-prometheus-secret.yml

用戶名是 admin筐赔,密碼是 admin

部署 prometheus server 的 deployment

vim 13-3-prometheus-deploy.yml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: prometheus-core
  namespace: monitoring
  labels:
    app: prometheus
    component: core
spec:
  replicas: 1
  selector:
    matchLabels:
      app: prometheus
      component: core
  template:
    metadata:
      name: prometheus-main
      labels:
        app: prometheus
        component: core
    spec:
      serviceAccountName: prometheus-k8s
      containers:
      - name: prometheus
        image: prom/prometheus:v1.7.0
        args:
          - '-storage.local.retention=12h'
          - '-storage.local.memory-chunks=500000'
          - '-config.file=/etc/prometheus/prometheus.yaml'
          - '-alertmanager.url=http://alertmanager:9093/'
        ports:
        - name: webui
          containerPort: 9090
        resources:
          requests:
            cpu: 500m
            memory: 500M
          limits:
            cpu: 500m
            memory: 500M
        volumeMounts:
        - name: config-volume
          mountPath: /etc/prometheus
        - name: rules-volume
          mountPath: /etc/prometheus-rules
      volumes:
      - name: config-volume
        configMap:
          name: prometheus-core
      - name: rules-volume
        configMap:
          name: prometheus-rules

kubectl apply -f 13-3-prometheus-deploy.yml

部署 prometheus server 的 service

vim 13-3-prometheus-service.yml
apiVersion: v1
kind: Service
metadata:
  name: prometheus
  namespace: monitoring
  labels:
    app: prometheus
    component: core
  annotations:
    prometheus.io/scrape: 'true'
spec:
  type: NodePort
  ports:
    - port: 9090
      protocol: TCP
      name: webui
      nodePort: 30091
  selector:
    app: prometheus
    component: core

kubectl apply -f 13-3-prometheus-service.yml

瀏覽器訪問(wèn):http://192.168.190.132:30091/graph

部署 Grafana

創(chuàng)建 Grafana Dashboard 模板相關(guān)的 configmap

vim grafana-net-2-dashboard-configmap.yml
apiVersion: v1
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: grafana-import-dashboards
  namespace: monitoring
data:
  grafana-net-2-dashboard.json: |
    {
      "__inputs": [{
        "name": "DS_PROMETHEUS",
        "label": "Prometheus",
        "description": "",
        "type": "datasource",
        "pluginId": "prometheus",
        "pluginName": "Prometheus"
      }],
      "__requires": [{
        "type": "panel",
        "id": "singlestat",
        "name": "Singlestat",
        "version": ""
      }, {
        "type": "panel",
        "id": "text",
        "name": "Text",
        "version": ""
      }, {
        "type": "panel",
        "id": "graph",
        "name": "Graph",
        "version": ""
      }, {
        "type": "grafana",
        "id": "grafana",
        "name": "Grafana",
        "version": "3.1.0"
      }, {
        "type": "datasource",
        "id": "prometheus",
        "name": "Prometheus",
        "version": "1.0.0"
      }],
      "id": null,
      "title": "Prometheus Stats",
      "tags": [],
      "style": "dark",
      "timezone": "browser",
      "editable": true,
      "hideControls": true,
      "sharedCrosshair": false,
      "rows": [{
        "collapse": false,
        "editable": true,
        "height": 178,
        "panels": [{
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"],
          "datasource": "${DS_PROMETHEUS}",
          "decimals": 1,
          "editable": true,
          "error": false,
          "format": "s",
          "id": 5,
          "interval": null,
          "links": [],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "span": 3,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "targets": [{
            "expr": "(time() - process_start_time_seconds{job=\"prometheus\"})",
            "intervalFactor": 2,
            "refId": "A",
            "step": 4
          }],
          "thresholds": "",
          "title": "Uptime",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [{
            "op": "=",
            "text": "N/A",
            "value": "null"
          }],
          "valueName": "current",
          "mappingTypes": [{
            "name": "value to text",
            "value": 1
          }, {
            "name": "range to text",
            "value": 2
          }],
          "rangeMaps": [{
            "from": "null",
            "to": "null",
            "text": "N/A"
          }],
          "mappingType": 1,
          "gauge": {
            "show": false,
            "minValue": 0,
            "maxValue": 100,
            "thresholdMarkers": true,
            "thresholdLabels": false
          }
        }, {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": ["rgba(50, 172, 45, 0.97)", "rgba(237, 129, 40, 0.89)", "rgba(245, 54, 54, 0.9)"],
          "datasource": "${DS_PROMETHEUS}",
          "editable": true,
          "error": false,
          "format": "none",
          "id": 6,
          "interval": null,
          "links": [],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "span": 3,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": true
          },
          "targets": [{
            "expr": "prometheus_local_storage_memory_series",
            "intervalFactor": 2,
            "refId": "A",
            "step": 4
          }],
          "thresholds": "1,5",
          "title": "Local Storage Memory Series",
          "type": "singlestat",
          "valueFontSize": "70%",
          "valueMaps": [],
          "valueName": "current",
          "mappingTypes": [{
            "name": "value to text",
            "value": 1
          }, {
            "name": "range to text",
            "value": 2
          }],
          "rangeMaps": [{
            "from": "null",
            "to": "null",
            "text": "N/A"
          }],
          "mappingType": 1,
          "gauge": {
            "show": false,
            "minValue": 0,
            "maxValue": 100,
            "thresholdMarkers": true,
            "thresholdLabels": false
          }
        }, {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": true,
          "colors": ["rgba(50, 172, 45, 0.97)", "rgba(237, 129, 40, 0.89)", "rgba(245, 54, 54, 0.9)"],
          "datasource": "${DS_PROMETHEUS}",
          "editable": true,
          "error": false,
          "format": "none",
          "id": 7,
          "interval": null,
          "links": [],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "span": 3,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": true
          },
          "targets": [{
            "expr": "prometheus_local_storage_indexing_queue_length",
            "intervalFactor": 2,
            "refId": "A",
            "step": 4
          }],
          "thresholds": "500,4000",
          "title": "Internal Storage Queue Length",
          "type": "singlestat",
          "valueFontSize": "70%",
          "valueMaps": [{
            "op": "=",
            "text": "Empty",
            "value": "0"
          }],
          "valueName": "current",
          "mappingTypes": [{
            "name": "value to text",
            "value": 1
          }, {
            "name": "range to text",
            "value": 2
          }],
          "rangeMaps": [{
            "from": "null",
            "to": "null",
            "text": "N/A"
          }],
          "mappingType": 1,
          "gauge": {
            "show": false,
            "minValue": 0,
            "maxValue": 100,
            "thresholdMarkers": true,
            "thresholdLabels": false
          }
        }, {
          "content": "<img src=\"http://prometheus.io/assets/prometheus_logo_grey.svg\" alt=\"Prometheus logo\" style=\"height: 40px;\">\n<span style=\"font-family: 'Open Sans', 'Helvetica Neue', Helvetica; font-size: 25px;vertical-align: text-top;color: #bbbfc2;margin-left: 10px;\">Prometheus</span>\n\n<p style=\"margin-top: 10px;\">You're using Prometheus, an open-source systems monitoring and alerting toolkit originally built at SoundCloud. For more information, check out the <a href=\"http://www.grafana.org/\">Grafana</a> and <a href=\"http://prometheus.io/\">Prometheus</a> projects.</p>",
          "editable": true,
          "error": false,
          "id": 9,
          "links": [],
          "mode": "html",
          "span": 3,
          "style": {},
          "title": "",
          "transparent": true,
          "type": "text"
        }],
        "title": "New row"
      }, {
        "collapse": false,
        "editable": true,
        "height": 227,
        "panels": [{
          "aliasColors": {
            "prometheus": "#C15C17",
            "{instance=\"localhost:9090\",job=\"prometheus\"}": "#C15C17"
          },
          "bars": false,
          "datasource": "${DS_PROMETHEUS}",
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "id": 3,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 9,
          "stack": false,
          "steppedLine": false,
          "targets": [{
            "expr": "rate(prometheus_local_storage_ingested_samples_total[5m])",
            "interval": "",
            "intervalFactor": 2,
            "legendFormat": "{{job}}",
            "metric": "",
            "refId": "A",
            "step": 2
          }],
          "timeFrom": null,
          "timeShift": null,
          "title": "Samples ingested (rate-5m)",
          "tooltip": {
            "shared": true,
            "value_type": "cumulative",
            "ordering": "alphabetical",
            "msResolution": false
          },
          "type": "graph",
          "yaxes": [{
            "show": true,
            "min": null,
            "max": null,
            "logBase": 1,
            "format": "short"
          }, {
            "show": true,
            "min": null,
            "max": null,
            "logBase": 1,
            "format": "short"
          }],
          "xaxis": {
            "show": true
          }
        }, {
          "content": "#### Samples Ingested\nThis graph displays the count of samples ingested by the Prometheus server, as measured over the last 5 minutes, per time series in the range vector. When troubleshooting an issue on IRC or Github, this is often the first stat requested by the Prometheus team. ",
          "editable": true,
          "error": false,
          "id": 8,
          "links": [],
          "mode": "markdown",
          "span": 2.995914043583536,
          "style": {},
          "title": "",
          "transparent": true,
          "type": "text"
        }],
        "title": "New row"
      }, {
        "collapse": false,
        "editable": true,
        "height": "250px",
        "panels": [{
          "aliasColors": {
            "prometheus": "#F9BA8F",
            "{instance=\"localhost:9090\",interval=\"5s\",job=\"prometheus\"}": "#F9BA8F"
          },
          "bars": false,
          "datasource": "${DS_PROMETHEUS}",
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "id": 2,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 5,
          "stack": false,
          "steppedLine": false,
          "targets": [{
            "expr": "rate(prometheus_target_interval_length_seconds_count[5m])",
            "intervalFactor": 2,
            "legendFormat": "{{job}}",
            "refId": "A",
            "step": 2
          }],
          "timeFrom": null,
          "timeShift": null,
          "title": "Target Scrapes (last 5m)",
          "tooltip": {
            "shared": true,
            "value_type": "cumulative",
            "ordering": "alphabetical",
            "msResolution": false
          },
          "type": "graph",
          "yaxes": [{
            "show": true,
            "min": null,
            "max": null,
            "logBase": 1,
            "format": "short"
          }, {
            "show": true,
            "min": null,
            "max": null,
            "logBase": 1,
            "format": "short"
          }],
          "xaxis": {
            "show": true
          }
        }, {
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_PROMETHEUS}",
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "id": 14,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 4,
          "stack": false,
          "steppedLine": false,
          "targets": [{
            "expr": "prometheus_target_interval_length_seconds{quantile!=\"0.01\", quantile!=\"0.05\"}",
            "interval": "",
            "intervalFactor": 2,
            "legendFormat": "{{quantile}} ({{interval}})",
            "metric": "",
            "refId": "A",
            "step": 2
          }],
          "timeFrom": null,
          "timeShift": null,
          "title": "Scrape Duration",
          "tooltip": {
            "shared": true,
            "value_type": "cumulative",
            "ordering": "alphabetical",
            "msResolution": false
          },
          "type": "graph",
          "yaxes": [{
            "show": true,
            "min": null,
            "max": null,
            "logBase": 1,
            "format": "short"
          }, {
            "show": true,
            "min": null,
            "max": null,
            "logBase": 1,
            "format": "short"
          }],
          "xaxis": {
            "show": true
          }
        }, {
          "content": "#### Scrapes\nPrometheus scrapes metrics from instrumented jobs, either directly or via an intermediary push gateway for short-lived jobs. Target scrapes will show how frequently targets are scraped, as measured over the last 5 minutes, per time series in the range vector. Scrape Duration will show how long the scrapes are taking, with percentiles available as series. ",
          "editable": true,
          "error": false,
          "id": 11,
          "links": [],
          "mode": "markdown",
          "span": 3,
          "style": {},
          "title": "",
          "transparent": true,
          "type": "text"
        }],
        "title": "New row"
      }, {
        "collapse": false,
        "editable": true,
        "height": "250px",
        "panels": [{
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_PROMETHEUS}",
          "decimals": null,
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "id": 12,
          "legend": {
            "alignAsTable": false,
            "avg": false,
            "current": false,
            "hideEmpty": true,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 9,
          "stack": false,
          "steppedLine": false,
          "targets": [{
            "expr": "prometheus_evaluator_duration_milliseconds{quantile!=\"0.01\", quantile!=\"0.05\"}",
            "interval": "",
            "intervalFactor": 2,
            "legendFormat": "{{quantile}}",
            "refId": "A",
            "step": 2
          }],
          "timeFrom": null,
          "timeShift": null,
          "title": "Rule Eval Duration",
          "tooltip": {
            "shared": true,
            "value_type": "cumulative",
            "ordering": "alphabetical",
            "msResolution": false
          },
          "type": "graph",
          "yaxes": [{
            "show": true,
            "min": null,
            "max": null,
            "logBase": 1,
            "format": "percentunit",
            "label": ""
          }, {
            "show": true,
            "min": null,
            "max": null,
            "logBase": 1,
            "format": "short"
          }],
          "xaxis": {
            "show": true
          }
        }, {
          "content": "#### Rule Evaluation Duration\nThis graph panel plots the duration for all evaluations to execute. The 50th percentile, 90th percentile and 99th percentile are shown as three separate series to help identify outliers that may be skewing the data.",
          "editable": true,
          "error": false,
          "id": 15,
          "links": [],
          "mode": "markdown",
          "span": 3,
          "style": {},
          "title": "",
          "transparent": true,
          "type": "text"
        }],
        "title": "New row"
      }],
      "time": {
        "from": "now-5m",
        "to": "now"
      },
      "timepicker": {
        "now": true,
        "refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
        "time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
      },
      "templating": {
        "list": []
      },
      "annotations": {
        "list": []
      },
      "refresh": false,
      "schemaVersion": 12,
      "version": 0,
      "links": [{
        "icon": "info",
        "tags": [],
        "targetBlank": true,
        "title": "Grafana Docs",
        "tooltip": "",
        "type": "link",
        "url": "http://www.grafana.org/docs"
      }, {
        "icon": "info",
        "tags": [],
        "targetBlank": true,
        "title": "Prometheus Docs",
        "type": "link",
        "url": "http://prometheus.io/docs/introduction/overview/"
      }],
      "gnetId": 2,
      "description": "The  official, pre-built Prometheus Stats Dashboard."
    }
  grafana-net-737-dashboard.json: |
    {
      "__inputs": [{
        "name": "DS_PROMETHEUS",
        "label": "prometheus",
        "description": "",
        "type": "datasource",
        "pluginId": "prometheus",
        "pluginName": "Prometheus"
      }],
      "__requires": [{
        "type": "panel",
        "id": "singlestat",
        "name": "Singlestat",
        "version": ""
      }, {
        "type": "panel",
        "id": "graph",
        "name": "Graph",
        "version": ""
      }, {
        "type": "grafana",
        "id": "grafana",
        "name": "Grafana",
        "version": "3.1.0"
      }, {
        "type": "datasource",
        "id": "prometheus",
        "name": "Prometheus",
        "version": "1.0.0"
      }],
      "id": null,
      "title": "Kubernetes Pod Resources",
      "description": "Shows resource usage of Kubernetes pods.",
      "tags": [
        "kubernetes"
      ],
      "style": "dark",
      "timezone": "browser",
      "editable": true,
      "hideControls": false,
      "sharedCrosshair": false,
      "rows": [{
        "collapse": false,
        "editable": true,
        "height": "250px",
        "panels": [{
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": true,
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "datasource": "${DS_PROMETHEUS}",
          "editable": true,
          "error": false,
          "format": "percent",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": true,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "height": "180px",
          "id": 4,
          "interval": null,
          "isNew": true,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [{
            "name": "value to text",
            "value": 1
          }, {
            "name": "range to text",
            "value": 2
          }],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [{
            "from": "null",
            "text": "N/A",
            "to": "null"
          }],
          "span": 4,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "targets": [{
            "expr": "sum (container_memory_working_set_bytes{id=\"/\",instance=~\"^$instance$\"}) / sum (machine_memory_bytes{instance=~\"^$instance$\"}) * 100",
            "interval": "",
            "intervalFactor": 2,
            "legendFormat": "",
            "refId": "A",
            "step": 2
          }],
          "thresholds": "65, 90",
          "timeFrom": "1m",
          "timeShift": null,
          "title": "Memory Working Set",
          "transparent": false,
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [{
            "op": "=",
            "text": "N/A",
            "value": "null"
          }],
          "valueName": "current"
        }, {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": true,
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "datasource": "${DS_PROMETHEUS}",
          "decimals": 2,
          "editable": true,
          "error": false,
          "format": "percent",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": true,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "height": "180px",
          "id": 6,
          "interval": null,
          "isNew": true,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [{
            "name": "value to text",
            "value": 1
          }, {
            "name": "range to text",
            "value": 2
          }],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [{
            "from": "null",
            "text": "N/A",
            "to": "null"
          }],
          "span": 4,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "targets": [{
            "expr": "sum(rate(container_cpu_usage_seconds_total{id=\"/\",instance=~\"^$instance$\"}[1m])) / sum (machine_cpu_cores{instance=~\"^$instance$\"}) * 100",
            "interval": "10s",
            "intervalFactor": 1,
            "refId": "A",
            "step": 10
          }],
          "thresholds": "65, 90",
          "timeFrom": "1m",
          "timeShift": null,
          "title": "Cpu Usage",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [{
            "op": "=",
            "text": "N/A",
            "value": "null"
          }],
          "valueName": "current"
        }, {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": true,
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "datasource": "${DS_PROMETHEUS}",
          "decimals": 2,
          "editable": true,
          "error": false,
          "format": "percent",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": true,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "height": "180px",
          "id": 7,
          "interval": null,
          "isNew": true,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [{
            "name": "value to text",
            "value": 1
          }, {
            "name": "range to text",
            "value": 2
          }],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [{
            "from": "null",
            "text": "N/A",
            "to": "null"
          }],
          "span": 4,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "targets": [{
            "expr": "sum(container_fs_usage_bytes{id=\"/\",instance=~\"^$instance$\"}) / sum(container_fs_limit_bytes{id=\"/\",instance=~\"^$instance$\"}) * 100",
            "interval": "10s",
            "intervalFactor": 1,
            "legendFormat": "",
            "metric": "",
            "refId": "A",
            "step": 10
          }],
          "thresholds": "65, 90",
          "timeFrom": "1m",
          "timeShift": null,
          "title": "Filesystem Usage",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [{
            "op": "=",
            "text": "N/A",
            "value": "null"
          }],
          "valueName": "current"
        }, {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "datasource": "${DS_PROMETHEUS}",
          "decimals": 2,
          "editable": true,
          "error": false,
          "format": "bytes",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "height": "1px",
          "hideTimeOverride": true,
          "id": 9,
          "interval": null,
          "isNew": true,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [{
            "name": "value to text",
            "value": 1
          }, {
            "name": "range to text",
            "value": 2
          }],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "20%",
          "prefix": "",
          "prefixFontSize": "20%",
          "rangeMaps": [{
            "from": "null",
            "text": "N/A",
            "to": "null"
          }],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "targets": [{
            "expr": "sum(container_memory_working_set_bytes{id=\"/\",instance=~\"^$instance$\"})",
            "interval": "10s",
            "intervalFactor": 1,
            "refId": "A",
            "step": 10
          }],
          "thresholds": "",
          "timeFrom": "1m",
          "title": "Used",
          "type": "singlestat",
          "valueFontSize": "50%",
          "valueMaps": [{
            "op": "=",
            "text": "N/A",
            "value": "null"
          }],
          "valueName": "current"
        }, {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "datasource": "${DS_PROMETHEUS}",
          "decimals": 2,
          "editable": true,
          "error": false,
          "format": "bytes",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "height": "1px",
          "hideTimeOverride": true,
          "id": 10,
          "interval": null,
          "isNew": true,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [{
            "name": "value to text",
            "value": 1
          }, {
            "name": "range to text",
            "value": 2
          }],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [{
            "from": "null",
            "text": "N/A",
            "to": "null"
          }],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "targets": [{
            "expr": "sum (machine_memory_bytes{instance=~\"^$instance$\"})",
            "interval": "10s",
            "intervalFactor": 1,
            "refId": "A",
            "step": 10
          }],
          "thresholds": "",
          "timeFrom": "1m",
          "title": "Total",
          "type": "singlestat",
          "valueFontSize": "50%",
          "valueMaps": [{
            "op": "=",
            "text": "N/A",
            "value": "null"
          }],
          "valueName": "current"
        }, {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "datasource": "${DS_PROMETHEUS}",
          "decimals": 2,
          "editable": true,
          "error": false,
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "height": "1px",
          "hideTimeOverride": true,
          "id": 11,
          "interval": null,
          "isNew": true,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [{
            "name": "value to text",
            "value": 1
          }, {
            "name": "range to text",
            "value": 2
          }],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": " cores",
          "postfixFontSize": "30%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [{
            "from": "null",
            "text": "N/A",
            "to": "null"
          }],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "targets": [{
            "expr": "sum (rate (container_cpu_usage_seconds_total{id=\"/\",instance=~\"^$instance$\"}[1m]))",
            "interval": "10s",
            "intervalFactor": 1,
            "refId": "A",
            "step": 10
          }],
          "thresholds": "",
          "timeFrom": "1m",
          "timeShift": null,
          "title": "Used",
          "type": "singlestat",
          "valueFontSize": "50%",
          "valueMaps": [{
            "op": "=",
            "text": "N/A",
            "value": "null"
          }],
          "valueName": "current"
        }, {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "datasource": "${DS_PROMETHEUS}",
          "decimals": 2,
          "editable": true,
          "error": false,
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "height": "1px",
          "hideTimeOverride": true,
          "id": 12,
          "interval": null,
          "isNew": true,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [{
            "name": "value to text",
            "value": 1
          }, {
            "name": "range to text",
            "value": 2
          }],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": " cores",
          "postfixFontSize": "30%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [{
            "from": "null",
            "text": "N/A",
            "to": "null"
          }],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "targets": [{
            "expr": "sum (machine_cpu_cores{instance=~\"^$instance$\"})",
            "interval": "10s",
            "intervalFactor": 1,
            "refId": "A",
            "step": 10
          }],
          "thresholds": "",
          "timeFrom": "1m",
          "title": "Total",
          "type": "singlestat",
          "valueFontSize": "50%",
          "valueMaps": [{
            "op": "=",
            "text": "N/A",
            "value": "null"
          }],
          "valueName": "current"
        }, {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "datasource": "${DS_PROMETHEUS}",
          "decimals": 2,
          "editable": true,
          "error": false,
          "format": "bytes",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "height": "1px",
          "hideTimeOverride": true,
          "id": 13,
          "interval": null,
          "isNew": true,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [{
            "name": "value to text",
            "value": 1
          }, {
            "name": "range to text",
            "value": 2
          }],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [{
            "from": "null",
            "text": "N/A",
            "to": "null"
          }],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "targets": [{
            "expr": "sum(container_fs_usage_bytes{id=\"/\",instance=~\"^$instance$\"})",
            "interval": "10s",
            "intervalFactor": 1,
            "refId": "A",
            "step": 10
          }],
          "thresholds": "",
          "timeFrom": "1m",
          "title": "Used",
          "type": "singlestat",
          "valueFontSize": "50%",
          "valueMaps": [{
            "op": "=",
            "text": "N/A",
            "value": "null"
          }],
          "valueName": "current"
        }, {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "datasource": "${DS_PROMETHEUS}",
          "decimals": 2,
          "editable": true,
          "error": false,
          "format": "bytes",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "height": "1px",
          "hideTimeOverride": true,
          "id": 14,
          "interval": null,
          "isNew": true,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [{
            "name": "value to text",
            "value": 1
          }, {
            "name": "range to text",
            "value": 2
          }],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [{
            "from": "null",
            "text": "N/A",
            "to": "null"
          }],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "targets": [{
            "expr": "sum (container_fs_limit_bytes{id=\"/\",instance=~\"^$instance$\"})",
            "interval": "10s",
            "intervalFactor": 1,
            "refId": "A",
            "step": 10
          }],
          "thresholds": "",
          "timeFrom": "1m",
          "title": "Total",
          "type": "singlestat",
          "valueFontSize": "50%",
          "valueMaps": [{
            "op": "=",
            "text": "N/A",
            "value": "null"
          }],
          "valueName": "current"
        }, {
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_PROMETHEUS}",
          "decimals": 2,
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)",
            "thresholdLine": false
          },
          "height": "200px",
          "id": 32,
          "isNew": true,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "max": false,
            "min": false,
            "rightSide": true,
            "show": true,
            "sideWidth": 200,
            "sort": "current",
            "sortDesc": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [{
            "expr": "sum(rate(container_network_receive_bytes_total{instance=~\"^$instance$\",namespace=~\"^$namespace$\"}[1m]))",
            "interval": "",
            "intervalFactor": 2,
            "legendFormat": "receive",
            "metric": "network",
            "refId": "A",
            "step": 240
          }, {
            "expr": "- sum(rate(container_network_transmit_bytes_total{instance=~\"^$instance$\",namespace=~\"^$namespace$\"}[1m]))",
            "interval": "",
            "intervalFactor": 2,
            "legendFormat": "transmit",
            "metric": "network",
            "refId": "B",
            "step": 240
          }],
          "timeFrom": null,
          "timeShift": null,
          "title": "Network",
          "tooltip": {
            "msResolution": false,
            "shared": true,
            "sort": 0,
            "value_type": "cumulative"
          },
          "transparent": false,
          "type": "graph",
          "xaxis": {
            "show": true
          },
          "yaxes": [{
            "format": "Bps",
            "label": "transmit / receive",
            "logBase": 1,
            "max": null,
            "min": null,
            "show": true
          }, {
            "format": "Bps",
            "label": null,
            "logBase": 1,
            "max": null,
            "min": null,
            "show": false
          }]
        }],
        "showTitle": true,
        "title": "all pods"
      }, {
        "collapse": false,
        "editable": true,
        "height": "250px",
        "panels": [{
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_PROMETHEUS}",
          "decimals": 3,
          "editable": true,
          "error": false,
          "fill": 0,
          "grid": {
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "height": "",
          "id": 17,
          "isNew": true,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "hideEmpty": true,
            "hideZero": true,
            "max": false,
            "min": false,
            "rightSide": true,
            "show": true,
            "sideWidth": null,
            "sort": "current",
            "sortDesc": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [{
            "expr": "sum(rate(container_cpu_usage_seconds_total{image!=\"\",name=~\"^k8s_.*\"}[1m])) by (pod_name)",
            "interval": "",
            "intervalFactor": 2,
            "legendFormat": "{{ pod_name }}",
            "metric": "container_cpu",
            "refId": "A",
            "step": 240
          }],
          "timeFrom": null,
          "timeShift": null,
          "title": "Cpu Usage",
          "tooltip": {
            "msResolution": true,
            "shared": false,
            "sort": 2,
            "value_type": "cumulative"
          },
          "transparent": false,
          "type": "graph",
          "xaxis": {
            "show": true
          },
          "yaxes": [{
            "format": "none",
            "label": "cores",
            "logBase": 1,
            "max": null,
            "min": null,
            "show": true
          }, {
            "format": "short",
            "label": null,
            "logBase": 1,
            "max": null,
            "min": null,
            "show": false
          }]
        }, {
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_PROMETHEUS}",
          "decimals": 2,
          "editable": true,
          "error": false,
          "fill": 0,
          "grid": {
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "id": 33,
          "isNew": true,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "hideEmpty": true,
            "hideZero": true,
            "max": false,
            "min": false,
            "rightSide": true,
            "show": true,
            "sideWidth": null,
            "sort": "current",
            "sortDesc": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [{
            "expr": "sum (container_memory_working_set_bytes{image!=\"\",name=~\"^k8s_.*\",instance=~\"^$instance$\",namespace=~\"^$namespace$\"}) by (pod_name)",
            "interval": "",
            "intervalFactor": 2,
            "legendFormat": "{{ pod_name }}",
            "metric": "",
            "refId": "A",
            "step": 240
          }],
          "timeFrom": null,
          "timeShift": null,
          "title": "Memory Working Set",
          "tooltip": {
            "msResolution": false,
            "shared": false,
            "sort": 2,
            "value_type": "cumulative"
          },
          "type": "graph",
          "xaxis": {
            "show": true
          },
          "yaxes": [{
            "format": "bytes",
            "label": "used",
            "logBase": 1,
            "max": null,
            "min": null,
            "show": true
          }, {
            "format": "short",
            "label": null,
            "logBase": 1,
            "max": null,
            "min": null,
            "show": false
          }]
        }, {
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_PROMETHEUS}",
          "decimals": 2,
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "id": 16,
          "isNew": true,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "hideEmpty": true,
            "hideZero": true,
            "max": false,
            "min": false,
            "rightSide": true,
            "show": true,
            "sideWidth": 200,
            "sort": "avg",
            "sortDesc": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [{
            "expr": "sum (rate (container_network_receive_bytes_total{image!=\"\",name=~\"^k8s_.*\",instance=~\"^$instance$\",namespace=~\"^$namespace$\"}[1m])) by (pod_name)",
            "interval": "",
            "intervalFactor": 2,
            "legendFormat": "{{ pod_name }} < in",
            "metric": "network",
            "refId": "A",
            "step": 240
          }, {
            "expr": "- sum (rate (container_network_transmit_bytes_total{image!=\"\",name=~\"^k8s_.*\",instance=~\"^$instance$\",namespace=~\"^$namespace$\"}[1m])) by (pod_name)",
            "interval": "",
            "intervalFactor": 2,
            "legendFormat": "{{ pod_name }} > out",
            "metric": "network",
            "refId": "B",
            "step": 240
          }],
          "timeFrom": null,
          "timeShift": null,
          "title": "Network",
          "tooltip": {
            "msResolution": false,
            "shared": false,
            "sort": 2,
            "value_type": "cumulative"
          },
          "type": "graph",
          "xaxis": {
            "show": true
          },
          "yaxes": [{
            "format": "Bps",
            "label": "transmit / receive",
            "logBase": 1,
            "max": null,
            "min": null,
            "show": true
          }, {
            "format": "short",
            "label": null,
            "logBase": 1,
            "max": null,
            "min": null,
            "show": false
          }]
        }, {
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_PROMETHEUS}",
          "decimals": 2,
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "id": 34,
          "isNew": true,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "hideEmpty": true,
            "hideZero": true,
            "max": false,
            "min": false,
            "rightSide": true,
            "show": true,
            "sideWidth": 200,
            "sort": "current",
            "sortDesc": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [{
            "expr": "sum(container_fs_usage_bytes{image!=\"\",name=~\"^k8s_.*\",instance=~\"^$instance$\",namespace=~\"^$namespace$\"}) by (pod_name)",
            "interval": "",
            "intervalFactor": 2,
            "legendFormat": "{{ pod_name }}",
            "metric": "network",
            "refId": "A",
            "step": 240
          }],
          "timeFrom": null,
          "timeShift": null,
          "title": "Filesystem",
          "tooltip": {
            "msResolution": false,
            "shared": false,
            "sort": 2,
            "value_type": "cumulative"
          },
          "type": "graph",
          "xaxis": {
            "show": true
          },
          "yaxes": [{
            "format": "bytes",
            "label": "used",
            "logBase": 1,
            "max": null,
            "min": null,
            "show": true
          }, {
            "format": "short",
            "label": null,
            "logBase": 1,
            "max": null,
            "min": null,
            "show": false
          }]
        }],
        "showTitle": true,
        "title": "each pod"
      }],
      "time": {
        "from": "now-3d",
        "to": "now"
      },
      "timepicker": {
        "refresh_intervals": [
          "5s",
          "10s",
          "30s",
          "1m",
          "5m",
          "15m",
          "30m",
          "1h",
          "2h",
          "1d"
        ],
        "time_options": [
          "5m",
          "15m",
          "1h",
          "6h",
          "12h",
          "24h",
          "2d",
          "7d",
          "30d"
        ]
      },
      "templating": {
        "list": [{
          "allValue": ".*",
          "current": {},
          "datasource": "${DS_PROMETHEUS}",
          "hide": 0,
          "includeAll": true,
          "label": "Instance",
          "multi": false,
          "name": "instance",
          "options": [],
          "query": "label_values(instance)",
          "refresh": 1,
          "regex": "",
          "type": "query"
        }, {
          "current": {},
          "datasource": "${DS_PROMETHEUS}",
          "hide": 0,
          "includeAll": true,
          "label": "Namespace",
          "multi": true,
          "name": "namespace",
          "options": [],
          "query": "label_values(namespace)",
          "refresh": 1,
          "regex": "",
          "type": "query"
        }]
      },
      "annotations": {
        "list": []
      },
      "refresh": false,
      "schemaVersion": 12,
      "version": 8,
      "links": [],
      "gnetId": 737
    }
  prometheus-datasource.json: |
    {
      "name": "prometheus",
      "type": "prometheus",
      "url": "http://prometheus:9090",
      "access": "proxy",
      "basicAuth": false
    }

kubectl apply -f grafana-net-2-dashboard-configmap.yml

部署 Grafana Server 的 Deployment

vim grafana-deploy.yml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: grafana-core
  namespace: monitoring
  labels:
    app: grafana
    component: core
spec:
  replicas: 1
  selector:
    matchLabels:
      app: grafana
      component: core
  template:
    metadata:
      labels:
        app: grafana
        component: core
    spec:
      containers:
      - image: grafana/grafana:4.2.0
        name: grafana-core
        imagePullPolicy: IfNotPresent
        resources:
          limits:
            cpu: 100m
            memory: 100Mi
          requests:
            cpu: 100m
            memory: 100Mi
        env:
          - name: GF_AUTH_BASIC_ENABLED
            value: "true"
          - name: GF_SECURITY_ADMIN_USER
            valueFrom:
              secretKeyRef:
                name: grafana
                key: admin-username
          - name: GF_SECURITY_ADMIN_PASSWORD
            valueFrom:
              secretKeyRef:
                name: grafana
                key: admin-password
          - name: GF_AUTH_ANONYMOUS_ENABLED
            value: "false"
        readinessProbe:
          httpGet:
            path: /login
            port: 3000
        volumeMounts:
        - name: grafana-persistent-storage
          mountPath: /var/lib/grafana
      volumes:
      - name: grafana-persistent-storage
        emptyDir: {}

kubectl apply -f grafana-deploy.yml

部署 Grafana Server 的 Service

vim grafana-service.yml
apiVersion: v1
kind: Service
metadata:
  name: grafana
  namespace: monitoring
  labels:
    app: grafana
    component: core
spec:
  type: NodePort
  ports:
    - port: 3000
  selector:
    app: grafana
    component: core

kubectl apply -f grafana-service.yml
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子匆绣,更是在濱河造成了極大的恐慌阅畴,老刑警劉巖,帶你破解...
    沈念sama閱讀 212,383評(píng)論 6 493
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件端盆,死亡現(xiàn)場(chǎng)離奇詭異料皇,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)涡匀,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,522評(píng)論 3 385
  • 文/潘曉璐 我一進(jìn)店門盯腌,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人陨瘩,你說(shuō)我怎么就攤上這事腕够。” “怎么了拾酝?”我有些...
    開封第一講書人閱讀 157,852評(píng)論 0 348
  • 文/不壞的土叔 我叫張陵燕少,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我蒿囤,道長(zhǎng)客们,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 56,621評(píng)論 1 284
  • 正文 為了忘掉前任材诽,我火速辦了婚禮底挫,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘脸侥。我一直安慰自己建邓,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,741評(píng)論 6 386
  • 文/花漫 我一把揭開白布睁枕。 她就那樣靜靜地躺著官边,像睡著了一般。 火紅的嫁衣襯著肌膚如雪外遇。 梳的紋絲不亂的頭發(fā)上注簿,一...
    開封第一講書人閱讀 49,929評(píng)論 1 290
  • 那天,我揣著相機(jī)與錄音跳仿,去河邊找鬼诡渴。 笑死,一個(gè)胖子當(dāng)著我的面吹牛菲语,可吹牛的內(nèi)容都是我干的妄辩。 我是一名探鬼主播,決...
    沈念sama閱讀 39,076評(píng)論 3 410
  • 文/蒼蘭香墨 我猛地睜開眼山上,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼眼耀!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起佩憾,我...
    開封第一講書人閱讀 37,803評(píng)論 0 268
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤哮伟,失蹤者是張志新(化名)和其女友劉穎潭辈,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體澈吨,經(jīng)...
    沈念sama閱讀 44,265評(píng)論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,582評(píng)論 2 327
  • 正文 我和宋清朗相戀三年寄摆,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了谅辣。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 38,716評(píng)論 1 341
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡婶恼,死狀恐怖桑阶,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情勾邦,我是刑警寧澤蚣录,帶...
    沈念sama閱讀 34,395評(píng)論 4 333
  • 正文 年R本政府宣布,位于F島的核電站眷篇,受9級(jí)特大地震影響萎河,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜蕉饼,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 40,039評(píng)論 3 316
  • 文/蒙蒙 一虐杯、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧昧港,春花似錦擎椰、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,798評(píng)論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至叹侄,卻和暖如春巩搏,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背圈膏。 一陣腳步聲響...
    開封第一講書人閱讀 32,027評(píng)論 1 266
  • 我被黑心中介騙來(lái)泰國(guó)打工塔猾, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人稽坤。 一個(gè)月前我還...
    沈念sama閱讀 46,488評(píng)論 2 361
  • 正文 我出身青樓丈甸,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親尿褪。 傳聞我的和親對(duì)象是個(gè)殘疾皇子睦擂,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,612評(píng)論 2 350

推薦閱讀更多精彩內(nèi)容