{{- $Values := (.helm).Values | default .Values }}
{{- $clusterLabel := ($Values.global).clusterLabel | default "cluster" }}
{{- $multicluster := ((($Values.grafana).sidecar).dashboards).multicluster | default false }}
{{- $defaultDatasource := "prometheus" -}}
{{- range (((($Values.grafana).sidecar).datasources).victoriametrics | default list) }}
  {{- if and .isDefault .type }}{{ $defaultDatasource = .type }}{{- end }}
{{- end }}
__elements: []
__inputs:
- description: ''
  label: Prometheus
  name: DS_PROMETHEUS
  pluginId: prometheus
  pluginName: Prometheus
  type: datasource
__requires:
- id: grafana
  name: Grafana
  type: grafana
  version: 8.4.4
- id: prometheus
  name: Prometheus
  type: datasource
  version: 5.0.0
- id: timeseries
  name: Time series
  type: panel
  version: ''
- id: stat
  name: Stat
  type: panel
  version: ''
annotations:
  list:
  - builtIn: 1
    datasource:
      type: datasource
      uid: grafana
    enable: true
    hide: true
    iconColor: rgba(0, 211, 255, 1)
    name: Annotations & Alerts
    target:
      limit: 100
      matchAny: false
      tags: []
      type: dashboard
    type: dashboard
  - datasource:
      type: datasource
      uid: grafana
    enable: true
    hide: false
    iconColor: '#5c4ee5'
    name: terraform
    target:
      limit: 100
      matchAny: false
      tags:
      - terraform
      type: tags
  - datasource:
      type: datasource
      uid: grafana
    enable: true
    hide: false
    iconColor: red
    name: oncall
    target:
      limit: 100
      matchAny: false
      tags:
      - oncall
      type: tags
condition: {{ ($Values.kubeApiServer).enabled }}
description: 'This is a modern API Server dashboard for your Kubernetes cluster(s). Made for kube-prometheus-stack and take advantage of the latest Grafana features. GitHub repository: https://github.com/dotdc/grafana-dashboards-kubernetes'
editable: false
fiscalYearStartMonth: 0
graphTooltip: 1
links: []
liveNow: false
panels:
- datasource:
    type: {{ $defaultDatasource }}
    uid: ${datasource}
  fieldConfig:
    defaults:
      mappings:
      - options:
          '0':
            text: DOWN
          '1':
            text: UP
        type: value
      thresholds:
        mode: absolute
        steps:
        - color: red
          value: null
        - color: green
          value: 1
    overrides: []
  gridPos:
    h: 8
    w: 12
    x: 0
    'y': 0
  id: 42
  options:
    colorMode: background
    graphMode: none
    justifyMode: auto
    orientation: horizontal
    reduceOptions:
      calcs:
      - lastNotNull
      fields: ''
      values: false
    textMode: value_and_name
  pluginVersion: 10.0.1
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    exemplar: true
    expr: up{job=~"kubernetes-apiservers|apiserver", {{ $clusterLabel }}=~"$cluster"}
    interval: ''
    legendFormat: '{{`{{`}} instance {{`}}`}}'
    refId: A
  title: API Server - Health Status
  type: stat
- datasource:
    type: {{ $defaultDatasource }}
    uid: ${datasource}
  fieldConfig:
    defaults:
      custom:
        align: auto
        cellOptions:
          type: auto
        inspect: false
      mappings: []
      thresholds:
        mode: absolute
        steps:
        - color: green
          value: null
        - color: red
          value: 80
    overrides:
    - matcher:
        id: byName
        options: __name__
      properties:
      - id: custom.width
        value: 188
  gridPos:
    h: 8
    w: 12
    x: 12
    'y': 0
  id: 60
  options:
    cellHeight: sm
    footer:
      countRows: false
      fields: ''
      reducer:
      - sum
      show: false
    showHeader: true
    sortBy:
    - desc: false
      displayName: removed_release
  pluginVersion: 10.0.1
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    exemplar: true
    expr: apiserver_requested_deprecated_apis{ {{ $clusterLabel }}=~"$cluster"}
    interval: ''
    legendFormat: ''
    refId: A
  title: Deprecated Kubernetes Resources
  transformations:
  - id: labelsToFields
    options:
      keepLabels:
      - group
      - job
      - removed_release
      - resource
      - version
      - name
      mode: columns
  - id: merge
    options: {}
  - id: organize
    options:
      excludeByName:
        Time: true
        Value: true
        job: true
      indexByName:
        Time: 6
        Value: 7
        group: 1
        job: 5
        namespace: 0
        removed_release: 4
        resource: 3
        version: 2
      renameByName: {}
  - id: groupBy
    options:
      fields:
        group:
          aggregations:
          - lastNotNull
          operation: groupby
        job:
          aggregations: []
          operation: groupby
        namespace:
          aggregations:
          - lastNotNull
          operation: groupby
        removed_release:
          aggregations: []
          operation: groupby
        resource:
          aggregations:
          - lastNotNull
          operation: groupby
        version:
          aggregations: []
          operation: groupby
  type: table
- datasource:
    type: {{ $defaultDatasource }}
    uid: ${datasource}
  fieldConfig:
    defaults:
      color:
        mode: palette-classic
      custom:
        axisCenteredZero: false
        axisColorMode: text
        axisLabel: ''
        axisPlacement: auto
        barAlignment: 0
        drawStyle: line
        fillOpacity: 25
        gradientMode: opacity
        hideFrom:
          legend: false
          tooltip: false
          viz: false
        lineInterpolation: smooth
        lineWidth: 2
        pointSize: 5
        scaleDistribution:
          type: linear
        showPoints: never
        spanNulls: false
        stacking:
          group: A
          mode: none
        thresholdsStyle:
          mode: 'off'
      mappings: []
      thresholds:
        mode: absolute
        steps:
        - color: green
          value: null
        - color: red
          value: 80
      unit: short
    overrides: []
  gridPos:
    h: 8
    w: 12
    x: 0
    'y': 8
  id: 38
  options:
    legend:
      calcs: []
      displayMode: list
      placement: bottom
      showLegend: true
    tooltip:
      mode: multi
      sort: desc
  pluginVersion: 8.3.3
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    exemplar: true
    expr: sum by (code) (rate(apiserver_request_total{ {{ $clusterLabel }}=~"$cluster"}[$__rate_interval]))
    interval: $resolution
    legendFormat: '{{`{{`}} code {{`}}`}}'
    refId: A
  title: API Server - HTTP Requests by code
  type: timeseries
- datasource:
    type: {{ $defaultDatasource }}
    uid: ${datasource}
  fieldConfig:
    defaults:
      color:
        mode: palette-classic
      custom:
        axisCenteredZero: false
        axisColorMode: text
        axisLabel: ''
        axisPlacement: auto
        barAlignment: 0
        drawStyle: line
        fillOpacity: 25
        gradientMode: opacity
        hideFrom:
          legend: false
          tooltip: false
          viz: false
        lineInterpolation: smooth
        lineWidth: 2
        pointSize: 5
        scaleDistribution:
          type: linear
        showPoints: never
        spanNulls: false
        stacking:
          group: A
          mode: none
        thresholdsStyle:
          mode: 'off'
      mappings: []
      thresholds:
        mode: absolute
        steps:
        - color: green
          value: null
        - color: red
          value: 80
      unit: short
    overrides: []
  gridPos:
    h: 8
    w: 12
    x: 12
    'y': 8
  id: 39
  options:
    legend:
      calcs: []
      displayMode: list
      placement: bottom
      showLegend: true
    tooltip:
      mode: multi
      sort: desc
  pluginVersion: 8.3.3
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    exemplar: true
    expr: sum by (verb) (rate(apiserver_request_total{ {{ $clusterLabel }}=~"$cluster"}[$__rate_interval]))
    interval: $resolution
    legendFormat: '{{`{{`}} verb{{`}}`}}'
    refId: A
  title: API Server - HTTP Requests by verb
  type: timeseries
- datasource:
    type: {{ $defaultDatasource }}
    uid: ${datasource}
  fieldConfig:
    defaults:
      color:
        mode: palette-classic
      custom:
        axisCenteredZero: false
        axisColorMode: text
        axisLabel: ''
        axisPlacement: auto
        barAlignment: 0
        drawStyle: line
        fillOpacity: 25
        gradientMode: opacity
        hideFrom:
          legend: false
          tooltip: false
          viz: false
        lineInterpolation: smooth
        lineWidth: 2
        pointSize: 5
        scaleDistribution:
          type: linear
        showPoints: never
        spanNulls: false
        stacking:
          group: A
          mode: none
        thresholdsStyle:
          mode: 'off'
      mappings: []
      thresholds:
        mode: absolute
        steps:
        - color: green
          value: null
        - color: red
          value: 80
      unit: ms
    overrides: []
  gridPos:
    h: 8
    w: 12
    x: 0
    'y': 16
  id: 53
  options:
    legend:
      calcs: []
      displayMode: list
      placement: bottom
      showLegend: true
    tooltip:
      mode: single
      sort: none
  pluginVersion: 8.3.3
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    exemplar: true
    expr: |-
      sum(rate(apiserver_request_duration_seconds_sum{job=~"kubernetes-apiservers|apiserver", {{ $clusterLabel }}=~"$cluster"}[$__rate_interval])) by (instance)
      /
      sum(rate(apiserver_request_duration_seconds_count{job=~"kubernetes-apiservers|apiserver", {{ $clusterLabel }}=~"$cluster"}[$__rate_interval])) by (instance)
    interval: $resolution
    legendFormat: '{{`{{`}} instance {{`}}`}}'
    refId: A
  title: API Server - HTTP Requests Latency by instance
  type: timeseries
- datasource:
    type: {{ $defaultDatasource }}
    uid: ${datasource}
  fieldConfig:
    defaults:
      color:
        mode: palette-classic
      custom:
        axisCenteredZero: false
        axisColorMode: text
        axisLabel: ''
        axisPlacement: auto
        barAlignment: 0
        drawStyle: line
        fillOpacity: 25
        gradientMode: opacity
        hideFrom:
          legend: false
          tooltip: false
          viz: false
        lineInterpolation: smooth
        lineWidth: 2
        pointSize: 5
        scaleDistribution:
          type: linear
        showPoints: never
        spanNulls: false
        stacking:
          group: A
          mode: none
        thresholdsStyle:
          mode: 'off'
      mappings: []
      thresholds:
        mode: absolute
        steps:
        - color: green
          value: null
        - color: red
          value: 80
      unit: ms
    overrides: []
  gridPos:
    h: 8
    w: 12
    x: 12
    'y': 16
  id: 54
  options:
    legend:
      calcs: []
      displayMode: list
      placement: bottom
      showLegend: true
    tooltip:
      mode: multi
      sort: desc
  pluginVersion: 8.3.3
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    exemplar: true
    expr: |-
      sum(rate(apiserver_request_duration_seconds_sum{job=~"kubernetes-apiservers|apiserver", {{ $clusterLabel }}=~"$cluster"}[$__rate_interval])) by (verb)
      /
      sum(rate(apiserver_request_duration_seconds_count{job=~"kubernetes-apiservers|apiserver", {{ $clusterLabel }}=~"$cluster"}[$__rate_interval])) by (verb)
    interval: $resolution
    legendFormat: '{{`{{`}} verb {{`}}`}}'
    refId: A
  title: API Server - HTTP Requests Latency by verb
  type: timeseries
- datasource:
    type: {{ $defaultDatasource }}
    uid: ${datasource}
  fieldConfig:
    defaults:
      color:
        mode: palette-classic
      custom:
        axisCenteredZero: false
        axisColorMode: text
        axisLabel: ''
        axisPlacement: auto
        barAlignment: 0
        drawStyle: line
        fillOpacity: 25
        gradientMode: opacity
        hideFrom:
          legend: false
          tooltip: false
          viz: false
        lineInterpolation: smooth
        lineWidth: 2
        pointSize: 5
        scaleDistribution:
          type: linear
        showPoints: never
        spanNulls: false
        stacking:
          group: A
          mode: none
        thresholdsStyle:
          mode: 'off'
      mappings: []
      thresholds:
        mode: absolute
        steps:
        - color: green
          value: null
        - color: red
          value: 80
      unit: short
    overrides: []
  gridPos:
    h: 8
    w: 12
    x: 0
    'y': 24
  id: 50
  options:
    legend:
      calcs: []
      displayMode: list
      placement: bottom
      showLegend: true
    tooltip:
      mode: single
      sort: none
  pluginVersion: 8.3.3
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    exemplar: true
    expr: |-
      sum by(instance) (rate(apiserver_request_total{code=~"5..", job=~"kubernetes-apiservers|apiserver", {{ $clusterLabel }}=~"$cluster"}[$__rate_interval]))
       / sum by(instance) (rate(apiserver_request_total{job=~"kubernetes-apiservers|apiserver", {{ $clusterLabel }}=~"$cluster"}[$__rate_interval]))
    interval: $resolution
    legendFormat: '{{`{{`}} instance {{`}}`}}'
    refId: A
  title: API Server - Errors by Instance
  type: timeseries
- datasource:
    type: {{ $defaultDatasource }}
    uid: ${datasource}
  fieldConfig:
    defaults:
      color:
        mode: palette-classic
      custom:
        axisCenteredZero: false
        axisColorMode: text
        axisLabel: ''
        axisPlacement: auto
        barAlignment: 0
        drawStyle: line
        fillOpacity: 25
        gradientMode: opacity
        hideFrom:
          legend: false
          tooltip: false
          viz: false
        lineInterpolation: smooth
        lineWidth: 2
        pointSize: 5
        scaleDistribution:
          type: linear
        showPoints: never
        spanNulls: false
        stacking:
          group: A
          mode: none
        thresholdsStyle:
          mode: 'off'
      mappings: []
      thresholds:
        mode: absolute
        steps:
        - color: green
          value: null
        - color: red
          value: 80
      unit: short
    overrides: []
  gridPos:
    h: 8
    w: 12
    x: 12
    'y': 24
  id: 51
  options:
    legend:
      calcs: []
      displayMode: list
      placement: bottom
      showLegend: true
    tooltip:
      mode: multi
      sort: none
  pluginVersion: 8.3.3
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    exemplar: true
    expr: |-
      sum by(verb) (rate(apiserver_request_total{code=~"5..",job=~"kubernetes-apiservers|apiserver", {{ $clusterLabel }}=~"$cluster"}[$__rate_interval]))
       / sum by(verb) (rate(apiserver_request_total{job=~"kubernetes-apiservers|apiserver", {{ $clusterLabel }}=~"$cluster"}[$__rate_interval]))
    interval: $resolution
    legendFormat: '{{`{{`}} verb {{`}}`}}'
    refId: A
  title: API Server - Errors by verb
  type: timeseries
- datasource:
    type: {{ $defaultDatasource }}
    uid: ${datasource}
  fieldConfig:
    defaults:
      color:
        mode: palette-classic
      custom:
        axisCenteredZero: false
        axisColorMode: text
        axisLabel: ''
        axisPlacement: auto
        barAlignment: 0
        drawStyle: line
        fillOpacity: 25
        gradientMode: opacity
        hideFrom:
          legend: false
          tooltip: false
          viz: false
        lineInterpolation: smooth
        lineWidth: 2
        pointSize: 5
        scaleDistribution:
          type: linear
        showPoints: never
        spanNulls: false
        stacking:
          group: A
          mode: normal
        thresholdsStyle:
          mode: 'off'
      mappings: []
      thresholds:
        mode: absolute
        steps:
        - color: green
          value: null
        - color: red
          value: 80
      unit: short
    overrides: []
  gridPos:
    h: 8
    w: 12
    x: 0
    'y': 32
  id: 40
  options:
    legend:
      calcs: []
      displayMode: list
      placement: bottom
      showLegend: true
    tooltip:
      mode: single
      sort: none
  pluginVersion: 8.3.3
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    exemplar: true
    expr: sum(rate(apiserver_request_total{ {{ $clusterLabel }}=~"$cluster"}[$__rate_interval])) by (instance)
    interval: $resolution
    legendFormat: '{{`{{`}} instance {{`}}`}}'
    refId: A
  title: API Server - Stacked HTTP Requests by instance
  type: timeseries
- datasource:
    type: {{ $defaultDatasource }}
    uid: ${datasource}
  fieldConfig:
    defaults:
      color:
        mode: palette-classic
      custom:
        axisCenteredZero: false
        axisColorMode: text
        axisLabel: ''
        axisPlacement: auto
        barAlignment: 0
        drawStyle: line
        fillOpacity: 25
        gradientMode: opacity
        hideFrom:
          legend: false
          tooltip: false
          viz: false
        lineInterpolation: smooth
        lineWidth: 2
        pointSize: 5
        scaleDistribution:
          type: linear
        showPoints: never
        spanNulls: false
        stacking:
          group: A
          mode: none
        thresholdsStyle:
          mode: 'off'
      mappings: []
      thresholds:
        mode: absolute
        steps:
        - color: green
          value: null
        - color: red
          value: 80
      unit: short
    overrides: []
  gridPos:
    h: 8
    w: 12
    x: 12
    'y': 32
  id: 56
  options:
    legend:
      calcs: []
      displayMode: list
      placement: bottom
      showLegend: true
    tooltip:
      mode: single
      sort: none
  pluginVersion: 8.3.3
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    exemplar: true
    expr: sum(rate(workqueue_depth{job=~"kubernetes-apiservers|apiserver", {{ $clusterLabel }}=~"$cluster"}[$__rate_interval])) by (instance)
    interval: $resolution
    legendFormat: '{{`{{`}} instance {{`}}`}}'
    refId: A
  title: API Server - Work Queue by instance
  type: timeseries
- datasource:
    type: {{ $defaultDatasource }}
    uid: ${datasource}
  fieldConfig:
    defaults:
      color:
        mode: palette-classic
      custom:
        axisCenteredZero: false
        axisColorMode: text
        axisLabel: ''
        axisPlacement: auto
        barAlignment: 0
        drawStyle: line
        fillOpacity: 25
        gradientMode: opacity
        hideFrom:
          legend: false
          tooltip: false
          viz: false
        lineInterpolation: smooth
        lineWidth: 2
        pointSize: 5
        scaleDistribution:
          type: linear
        showPoints: never
        spanNulls: false
        stacking:
          group: A
          mode: none
        thresholdsStyle:
          mode: 'off'
      decimals: 2
      mappings: []
      thresholds:
        mode: absolute
        steps:
        - color: green
          value: null
        - color: red
          value: 80
      unit: percent
    overrides: []
  gridPos:
    h: 8
    w: 12
    x: 0
    'y': 40
  id: 47
  options:
    legend:
      calcs: []
      displayMode: list
      placement: bottom
      showLegend: true
    tooltip:
      mode: single
      sort: none
  pluginVersion: 8.3.3
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    exemplar: true
    expr: rate(process_cpu_seconds_total{job=~"kubernetes-apiservers|apiserver", {{ $clusterLabel }}=~"$cluster"}[$__rate_interval])
    interval: $resolution
    legendFormat: '{{`{{`}} instance {{`}}`}}'
    refId: A
  title: API Server - CPU Usage by instance
  type: timeseries
- datasource:
    type: {{ $defaultDatasource }}
    uid: ${datasource}
  fieldConfig:
    defaults:
      color:
        mode: palette-classic
      custom:
        axisCenteredZero: false
        axisColorMode: text
        axisLabel: ''
        axisPlacement: auto
        barAlignment: 0
        drawStyle: line
        fillOpacity: 25
        gradientMode: opacity
        hideFrom:
          legend: false
          tooltip: false
          viz: false
        lineInterpolation: smooth
        lineWidth: 2
        pointSize: 5
        scaleDistribution:
          type: linear
        showPoints: never
        spanNulls: false
        stacking:
          group: A
          mode: none
        thresholdsStyle:
          mode: 'off'
      mappings: []
      thresholds:
        mode: absolute
        steps:
        - color: green
          value: null
        - color: red
          value: 80
      unit: bytes
    overrides: []
  gridPos:
    h: 8
    w: 12
    x: 12
    'y': 40
  id: 48
  options:
    legend:
      calcs: []
      displayMode: list
      placement: bottom
      showLegend: true
    tooltip:
      mode: single
      sort: none
  pluginVersion: 8.3.3
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    exemplar: true
    expr: process_resident_memory_bytes{job=~"kubernetes-apiservers|apiserver", {{ $clusterLabel }}=~"$cluster"}
    interval: $resolution
    legendFormat: '{{`{{`}} instance {{`}}`}}'
    refId: A
  title: API Server - Memory Usage by instance
  type: timeseries
refresh: 30s
schemaVersion: 38
style: dark
tags:
- Kubernetes
- Prometheus
- vm-k8s-stack
templating:
  list:
  - current:
      selected: false
      text: Prometheus
      value: Prometheus
    hide: 0
    includeAll: false
    label: ''
    multi: false
    name: datasource
    options: []
    query: {{ $defaultDatasource }}
    queryValue: ''
    refresh: 1
    regex: ''
    skipUrlSync: false
    type: datasource
  - current:
      isNone: true
      selected: false
      text: None
      value: ''
    datasource:
      type: prometheus
      uid: ${datasource}
    definition: label_values(kube_node_info,{{ $clusterLabel }})
    hide: {{ ternary 0 2 $multicluster }}
    includeAll: false
    multi: false
    name: cluster
    options: []
    query: {{ ternary (b64dec "eyJxcnlUeXBlIjogMSwgInF1ZXJ5IjogImxhYmVsX3ZhbHVlcyhrdWJlX25vZGVfaW5mbyxjbHVzdGVyKSIsICJyZWZJZCI6ICJQcm9tZXRoZXVzVmFyaWFibGVRdWVyeUVkaXRvci1WYXJpYWJsZVF1ZXJ5In0=" | replace "cluster" $clusterLabel) ".*" $multicluster }}
    refresh: 1
    regex: ''
    skipUrlSync: false
    sort: 1
    type: {{ ternary "query" "constant" $multicluster }}
  - current:
      selected: true
      text: 30s
      value: 30s
    hide: 0
    includeAll: false
    multi: false
    name: resolution
    options:
    - selected: false
      text: 1s
      value: 1s
    - selected: false
      text: 15s
      value: 15s
    - selected: true
      text: 30s
      value: 30s
    - selected: false
      text: 1m
      value: 1m
    - selected: false
      text: 3m
      value: 3m
    - selected: false
      text: 5m
      value: 5m
    query: 1s, 15s, 30s, 1m, 3m, 5m
    queryValue: ''
    skipUrlSync: false
    type: custom
time:
  from: now-1h
  to: now
timepicker: {}
timezone: {{ default "utc" ($Values.defaultDashboards).defaultTimezone }}
title: Kubernetes / System / API Server
uid: k8s_system_apisrv
version: 19
weekStart: ''
