Grafana dashboard: Monster workloads
Description: Shows the 20 largest containers running in your Kubernetes cluster, by maximum CPU usage and memory usage over the last 2 days

This dashboard relies on recording rules defined in kube-prometheus to show the most resource-intensive containers in the cluster

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.5.4"
    },
    {
      "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",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": 15131,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "panels": [
    {
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": null,
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 15,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "options": {
        "frameIndex": 0,
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Value #A"
          }
        ]
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "exemplar": true,
          "expr": "topk(20,max_over_time(max(node_namespace_pod_container:container_memory_working_set_bytes) by (container,pod,namespace,node)[2d:15m])) / (1024 * 1024)",
          "format": "table",
          "instant": true,
          "interval": "",
          "legendFormat": "usage (max)",
          "queryType": "randomWalk",
          "refId": "A"
        },
        {
          "exemplar": true,
          "expr": "topk(200,max(kube_pod_container_resource_requests{resource=\"memory\"}) by (container,pod,namespace,node)) / (1024 * 1024)",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "legendFormat": "requests",
          "refId": "B"
        },
        {
          "exemplar": true,
          "expr": "topk(200,max(kube_pod_container_resource_limits{resource=\"memory\"}) by (container,pod,namespace,node)) / (1024 * 1024)",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "C"
        },
        {
          "exemplar": true,
          "expr": "( topk(200,max(kube_pod_container_resource_limits{resource=\"memory\"}) by (container,pod,namespace,node)) ) / ( topk(200,max(kube_pod_container_resource_requests{resource=\"memory\"}) by (container,pod,namespace,node)) )",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "D"
        }
      ],
      "title": "Highest Memory Usage Containers ",
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "greater",
                  "options": {
                    "value": 0
                  }
                },
                "fieldName": "Value #A"
              }
            ],
            "match": "any",
            "type": "include"
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": null,
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "pod"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 287
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 15,
        "w": 24,
        "x": 0,
        "y": 15
      },
      "id": 3,
      "options": {
        "frameIndex": 0,
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Value #A"
          }
        ]
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "exemplar": true,
          "expr": "topk(20,max_over_time(max(node_namespace_pod_container:container_cpu_usage_seconds_total:sum_rate) by (container,pod,namespace,node)[2d:15m]))",
          "format": "table",
          "instant": true,
          "interval": "",
          "legendFormat": "usage (max)",
          "queryType": "randomWalk",
          "refId": "A"
        },
        {
          "exemplar": true,
          "expr": "topk(200,max(kube_pod_container_resource_requests{resource=\"cpu\"}) by (container,pod,namespace,node))",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "legendFormat": "requests",
          "refId": "B"
        },
        {
          "exemplar": true,
          "expr": "topk(200,max(kube_pod_container_resource_limits{resource=\"cpu\"}) by (container,pod,namespace,node))",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "C"
        },
        {
          "exemplar": true,
          "expr": "( topk(200,max(kube_pod_container_resource_limits{resource=\"cpu\"}) by (container,pod,namespace,node)) ) / ( topk(200,max(kube_pod_container_resource_requests{resource=\"memory\"}) by (container,pod,namespace,node)) )",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "D"
        }
      ],
      "title": "Highest CPU Usage Containers ",
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "greater",
                  "options": {
                    "value": 0
                  }
                },
                "fieldName": "Value #A"
              }
            ],
            "match": "any",
            "type": "include"
          }
        }
      ],
      "type": "table"
    }
  ],
  "schemaVersion": 27,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Monster workloads",
  "uid": "4F9YRoO7k",
  "version": 2,
  "description": "Shows the 20 largest containers running in your Kubernetes cluster, by maximum CPU usage and memory usage over the last 2 days"
}