Grafana dashboard: Information about pods

Simply describes deployed containers by using of memory, cpu and network. Has selectors for Namespaces, containers and pods.

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.1.6"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph (old)",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": 14651,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1659716632800,
  "links": [],
  "panels": [
    {
      "collapsed": true,
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      },
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 7,
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_PROMETHEUS}",
          "fieldConfig": {
            "defaults": {
              "links": []
            },
            "overrides": []
          },
          "fill": 1,
          "fillGradient": 0,
          "gridPos": {
            "h": 11,
            "w": 24,
            "x": 0,
            "y": 1
          },
          "hiddenSeries": false,
          "id": 2,
          "legend": {
            "alignAsTable": true,
            "avg": false,
            "current": true,
            "max": true,
            "min": false,
            "rightSide": true,
            "show": true,
            "sort": "current",
            "sortDesc": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 1,
          "nullPointMode": "null",
          "options": {
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "8.1.6",
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "exemplar": true,
              "expr": "sum(rate(container_cpu_usage_seconds_total{namespace=~\"$namespace\",container=~\"$container\",container!=\"\",container!=\"POD\",pod=~\"$pod\"}[5m])) by (namespace,container,pod) / 8 * 100 > 1",
              "hide": false,
              "interval": "",
              "intervalFactor": 4,
              "legendFormat": "{{namespace}} -> {{container}} -> {{pod}}",
              "refId": "B"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "CPU Using by Pods ( > 1%)",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "percent",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "datasource": "${DS_PROMETHEUS}",
          "fieldConfig": {
            "defaults": {
              "color": {
                "mode": "thresholds"
              },
              "custom": {
                "align": "auto",
                "displayMode": "auto"
              },
              "links": [],
              "mappings": [],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green",
                    "value": null
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              },
              "unit": "short"
            },
            "overrides": []
          },
          "gridPos": {
            "h": 9,
            "w": 12,
            "x": 0,
            "y": 12
          },
          "id": 21,
          "options": {
            "showHeader": true
          },
          "pluginVersion": "8.1.6",
          "targets": [
            {
              "exemplar": true,
              "expr": "kube_pod_container_resource_limits{resource=\"cpu\",namespace=~\"$namespace\",container=~\"$container\",container!=\"\",container!=\"POD\"}>0",
              "format": "table",
              "hide": false,
              "instant": false,
              "interval": "",
              "legendFormat": "{{namespace}} -> {{container}} -> {{pod}}",
              "refId": "B"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Limits CPU",
          "transformations": [
            {
              "id": "organize",
              "options": {
                "excludeByName": {
                  "Time": false
                },
                "indexByName": {},
                "renameByName": {
                  "Value #B": "Cores",
                  "namespace": "Namespace",
                  "pod": "Pod name"
                }
              }
            },
            {
              "id": "groupBy",
              "options": {
                "fields": {
                  "Cores": {
                    "aggregations": [],
                    "operation": "groupby"
                  },
                  "Namespace": {
                    "aggregations": [],
                    "operation": "groupby"
                  },
                  "Pod name": {
                    "aggregations": [],
                    "operation": "groupby"
                  }
                }
              }
            }
          ],
          "type": "table"
        }
      ],
      "title": "CPU",
      "type": "row"
    },
    {
      "collapsed": true,
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      },
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 1
      },
      "id": 9,
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_PROMETHEUS}",
          "fill": 1,
          "fillGradient": 0,
          "gridPos": {
            "h": 10,
            "w": 24,
            "x": 0,
            "y": 2
          },
          "hiddenSeries": false,
          "id": 3,
          "legend": {
            "alignAsTable": true,
            "avg": false,
            "current": true,
            "max": true,
            "min": false,
            "rightSide": true,
            "show": true,
            "sort": "current",
            "sortDesc": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 1,
          "nullPointMode": "null",
          "options": {
            "alertThreshold": true,
            "dataLinks": []
          },
          "percentage": false,
          "pluginVersion": "8.1.6",
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "sum(container_memory_usage_bytes{namespace=~\"$namespace\",container=~\"$container\",container!=\"\",container!=\"POD\",pod=~\"$pod\"})+0.000001",
              "hide": true,
              "interval": "",
              "intervalFactor": 4,
              "legendFormat": "Всего:",
              "refId": "A"
            },
            {
              "exemplar": true,
              "expr": "sort(container_memory_usage_bytes{namespace=~\"$namespace\",container=~\"$container\",container!=\"\",container!=\"POD\",pod=~\"$pod\"})",
              "hide": false,
              "interval": "",
              "intervalFactor": 4,
              "legendFormat": "{{namespace}} -> {{pod}} -> {{container}}",
              "refId": "C"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Memory Used",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "bytes",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "datasource": "${DS_PROMETHEUS}",
          "description": "",
          "fieldConfig": {
            "defaults": {
              "color": {
                "mode": "thresholds"
              },
              "custom": {
                "align": "auto",
                "displayMode": "auto"
              },
              "mappings": [],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green",
                    "value": null
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              },
              "unit": "percent"
            },
            "overrides": []
          },
          "gridPos": {
            "h": 9,
            "w": 7,
            "x": 0,
            "y": 12
          },
          "id": 22,
          "options": {
            "showHeader": true,
            "sortBy": [
              {
                "desc": true,
                "displayName": "% of request (max)"
              }
            ]
          },
          "pluginVersion": "8.1.6",
          "targets": [
            {
              "exemplar": true,
              "expr": "sum by (namespace,pod,container)(container_memory_usage_bytes{namespace=~\"$namespace\",container=~\"$container\",container!=\"\",container!=\"POD\",pod=~\"$pod\"}) / sum by (namespace,pod,container)(kube_pod_container_resource_requests{resource=\"memory\",namespace=~\"$namespace\",container=~\"$container\",container!=\"\",container!=\"POD\"}) * 100 > 90",
              "format": "table",
              "hide": false,
              "interval": "",
              "legendFormat": "{{namespace}} -> {{pod}} -> {{container}}",
              "refId": "C"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "% used over memory request (>90)",
          "transformations": [
            {
              "id": "organize",
              "options": {
                "excludeByName": {
                  "Time": true,
                  "container": true
                },
                "indexByName": {},
                "renameByName": {
                  "Value #C": "% of request",
                  "namespace": "Namespace",
                  "pod": "Pod name"
                }
              }
            },
            {
              "id": "groupBy",
              "options": {
                "fields": {
                  "% of request": {
                    "aggregations": [
                      "max"
                    ],
                    "operation": "aggregate"
                  },
                  "Namespace": {
                    "aggregations": [],
                    "operation": "groupby"
                  },
                  "Pod name": {
                    "aggregations": [],
                    "operation": "groupby"
                  }
                }
              }
            }
          ],
          "type": "table"
        },
        {
          "datasource": "${DS_PROMETHEUS}",
          "fieldConfig": {
            "defaults": {
              "color": {
                "mode": "thresholds"
              },
              "custom": {
                "align": "auto",
                "displayMode": "auto"
              },
              "mappings": [],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green",
                    "value": null
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              },
              "unit": "bytes"
            },
            "overrides": []
          },
          "gridPos": {
            "h": 9,
            "w": 8,
            "x": 7,
            "y": 12
          },
          "id": 18,
          "options": {
            "showHeader": true,
            "sortBy": [
              {
                "desc": true,
                "displayName": "Memory limit"
              }
            ]
          },
          "pluginVersion": "8.1.6",
          "targets": [
            {
              "expr": "sum(kube_pod_container_resource_limits{resource=\"memory\",namespace=~\"$namespace\",container=~\"$container\",container!=\"\",container!=\"POD\",pod=~\"$pod\"})+0.000001",
              "hide": true,
              "interval": "",
              "legendFormat": "Всего:",
              "refId": "A"
            },
            {
              "exemplar": true,
              "expr": "kube_pod_container_resource_limits{resource=\"memory\",namespace=~\"$namespace\",container=~\"$container\",container!=\"\",container!=\"POD\",pod=~\"$pod\"}>0",
              "format": "table",
              "hide": false,
              "interval": "",
              "legendFormat": "{{namespace}} -> {{pod}} -> {{container}}",
              "refId": "B"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Limits of Memory",
          "transformations": [
            {
              "id": "organize",
              "options": {
                "excludeByName": {
                  "Time": true,
                  "__name__": true,
                  "app_kubernetes_io_instance": true,
                  "app_kubernetes_io_managed_by": true,
                  "app_kubernetes_io_name": true,
                  "container": true,
                  "helm_sh_chart": true,
                  "instance": true,
                  "job": true,
                  "kubernetes_name": true,
                  "kubernetes_namespace": true,
                  "kubernetes_node": true,
                  "node": true,
                  "resource": true,
                  "unit": true
                },
                "indexByName": {},
                "renameByName": {
                  "Value #B": "Memory limit",
                  "namespace": "Namespace",
                  "pod": "Pod name"
                }
              }
            },
            {
              "id": "groupBy",
              "options": {
                "fields": {
                  "Memory limit": {
                    "aggregations": [],
                    "operation": "groupby"
                  },
                  "Namespace": {
                    "aggregations": [],
                    "operation": "groupby"
                  },
                  "Pod name": {
                    "aggregations": [],
                    "operation": "groupby"
                  }
                }
              }
            }
          ],
          "type": "table"
        },
        {
          "datasource": "${DS_PROMETHEUS}",
          "fieldConfig": {
            "defaults": {
              "color": {
                "mode": "thresholds"
              },
              "custom": {
                "align": "auto",
                "displayMode": "auto"
              },
              "mappings": [],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green",
                    "value": null
                  },
                  {
                    "color": "red",
                    "value": 80
                  }
                ]
              },
              "unit": "percent"
            },
            "overrides": []
          },
          "gridPos": {
            "h": 9,
            "w": 9,
            "x": 15,
            "y": 12
          },
          "id": 20,
          "options": {
            "showHeader": true
          },
          "pluginVersion": "8.1.6",
          "targets": [
            {
              "exemplar": true,
              "expr": "(sum by (namespace,pod,container)(container_memory_usage_bytes{namespace=~\"$namespace\",container=~\"$container\",container!=\"\",container!=\"POD\",pod=~\"$pod\"}) / sum by (namespace,pod,container)(kube_pod_container_resource_limits{resource=\"memory\",namespace=~\"$namespace\",container=~\"$container\",container!=\"\",container!=\"POD\"}))*100 > 80",
              "format": "table",
              "interval": "",
              "legendFormat": "{{namespace}} -> {{pod}} -> {{container}}",
              "refId": "A"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "% of used memory limit (>80)",
          "transformations": [
            {
              "id": "organize",
              "options": {
                "excludeByName": {
                  "Time": true,
                  "container": true
                },
                "indexByName": {},
                "renameByName": {
                  "Value #A": "% of limit",
                  "namespace": "Namespace",
                  "pod": "Pod name"
                }
              }
            },
            {
              "id": "groupBy",
              "options": {
                "fields": {
                  "% of limit": {
                    "aggregations": [
                      "max"
                    ],
                    "operation": "aggregate"
                  },
                  "Namespace": {
                    "aggregations": [],
                    "operation": "groupby"
                  },
                  "Pod name": {
                    "aggregations": [],
                    "operation": "groupby"
                  }
                }
              }
            }
          ],
          "type": "table"
        }
      ],
      "title": "RAM",
      "type": "row"
    },
    {
      "collapsed": true,
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      },
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 2
      },
      "id": 11,
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_PROMETHEUS}",
          "description": "",
          "fill": 1,
          "fillGradient": 0,
          "gridPos": {
            "h": 11,
            "w": 24,
            "x": 0,
            "y": 3
          },
          "hiddenSeries": false,
          "id": 4,
          "legend": {
            "alignAsTable": true,
            "avg": false,
            "current": true,
            "max": true,
            "min": false,
            "rightSide": true,
            "show": true,
            "sort": "current",
            "sortDesc": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 1,
          "nullPointMode": "null",
          "options": {
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "8.1.6",
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "sum(irate(container_network_receive_bytes_total{namespace=~\"$namespace\",namespace!=\"\",interface=\"eth0\"}[3m]))",
              "hide": true,
              "instant": false,
              "interval": "",
              "intervalFactor": 4,
              "legendFormat": "Всего принято",
              "refId": "B"
            },
            {
              "expr": "sum(irate(container_network_receive_bytes_total{namespace=~\"$namespace\",namespace!=\"\",interface=\"eth0\",pod=~\"$pod\"}[3m])) by (namespace,pod)",
              "instant": false,
              "interval": "",
              "intervalFactor": 4,
              "legendFormat": "{{namespace}} -> {{pod}}",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Сетевая активность (принято)",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "Bps",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_PROMETHEUS}",
          "description": "",
          "fill": 1,
          "fillGradient": 0,
          "gridPos": {
            "h": 11,
            "w": 24,
            "x": 0,
            "y": 14
          },
          "hiddenSeries": false,
          "id": 5,
          "legend": {
            "alignAsTable": true,
            "avg": false,
            "current": true,
            "max": true,
            "min": false,
            "rightSide": true,
            "show": true,
            "sort": "current",
            "sortDesc": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 1,
          "nullPointMode": "null",
          "options": {
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "8.1.6",
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "sum(irate(container_network_transmit_bytes_total{namespace=~\"$namespace\",namespace!=\"\",interface=\"eth0\"}[3m]))",
              "hide": true,
              "instant": false,
              "interval": "",
              "intervalFactor": 4,
              "legendFormat": "Всего отправлено",
              "refId": "D"
            },
            {
              "expr": "sum(irate(container_network_transmit_bytes_total{namespace=~\"$namespace\",namespace!=\"\",interface=\"eth0\",pod=~\"$pod\"}[3m])) by (namespace,pod)",
              "hide": false,
              "instant": false,
              "interval": "",
              "intervalFactor": 4,
              "legendFormat": "{{namespace}} -> {{pod}}",
              "refId": "C"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Сетевая активность (отправлено)",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "Bps",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        }
      ],
      "title": "Networking (примечание: селектор container не влияет на этот раздел)",
      "type": "row"
    }
  ],
  "refresh": false,
  "schemaVersion": 30,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": ".*",
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(kube_pod_info, namespace)",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "Namespace",
        "multi": true,
        "name": "namespace",
        "options": [],
        "query": {
          "query": "label_values(kube_pod_info, namespace)",
          "refId": "Prometheus-namespace-Variable-Query"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": ".*",
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(kube_pod_container_info{namespace=~\"$namespace\"},pod)",
        "description": "",
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "Pod",
        "multi": true,
        "name": "pod",
        "options": [],
        "query": {
          "query": "label_values(kube_pod_container_info{namespace=~\"$namespace\"},pod)",
          "refId": "Prometheus-pod-Variable-Query"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": ".*",
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(kube_pod_container_info{namespace=~\"$namespace\",pod=~\"$pod\"}, container)",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "Container",
        "multi": true,
        "name": "container",
        "options": [],
        "query": {
          "query": "label_values(kube_pod_container_info{namespace=~\"$namespace\",pod=~\"$pod\"}, container)",
          "refId": "Prometheus-container-Variable-Query"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-5m",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "Information about pods",
  "uid": "YQcrazd7z",
  "version": 10
}