Grafana dashboard: Kubernetes Cluster for RAM and CPU Utilization
Description: Shows RAM and CPU utilization grouped by namespaces, deployments and specific pods. This dashboard shows the values at specific point in time, its useful for getting an instant feeling about what takes most of the resources in the cluster.

This dashboard shows the utilization, RAM and CPU, of a cluster at a specific point in time.

It helps to answer those questions quickly:
1. Is my cluster running out of RAM or CPU?
2. If so, what are the problematic namespaces, deployments and pods?

---

This dashboard uses the default metrics from the Prometheus Helm chart. It needs both Kubelet and Node Exporter metrics.

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "panel",
      "id": "bargauge",
      "name": "Bar gauge",
      "version": ""
    },
    {
      "type": "panel",
      "id": "gauge",
      "name": "Gauge",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.0.5"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "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"
      }
    ]
  },
  "description": "Shows RAM and CPU utilization grouped by namespaces, deployments and specific pods. This dashboard shows the values at specific point in time, its useful for getting an instant feeling about what takes most of the resources in the cluster.",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "description": "The memory usage in percentage of all nodes in the cluster.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "options": {
                "null": {
                  "index": 0,
                  "text": "N/A"
                }
              },
              "type": "value"
            }
          ],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": 65
              },
              {
                "color": "red",
                "value": 90
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 3,
        "x": 0,
        "y": 0
      },
      "id": 13,
      "options": {
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": true
      },
      "pluginVersion": "9.0.5",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "editorMode": "code",
          "expr": "(sum (node_memory_MemTotal_bytes) - sum (node_memory_MemAvailable_bytes)) / sum (node_memory_MemTotal_bytes) * 100",
          "legendFormat": "__auto",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Memory Usage",
      "type": "gauge"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "description": "The average CPU usage of all the nodes in the cluster.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "links": [],
          "mappings": [
            {
              "options": {
                "null": {
                  "index": 0,
                  "text": "N/A"
                }
              },
              "type": "value"
            }
          ],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": 65
              },
              {
                "color": "red",
                "value": 90
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 3,
        "x": 3,
        "y": 0
      },
      "id": 12,
      "options": {
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": true
      },
      "pluginVersion": "9.0.5",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "avg(100 - (avg by (node) (rate(node_cpu_seconds_total{mode=\"idle\"}[5m])) * 100))",
          "format": "time_series",
          "instant": false,
          "legendFormat": "__auto",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "CPU Usage",
      "type": "gauge"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "description": "A list of all nodes in the cluster along with their spec. This table helps to get a quick idea about the resources in the cluster.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Linux version"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 268
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "CPU"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 96
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "node"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 239
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Arch"
            },
            "properties": [
              {
                "id": "custom.width"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 14,
        "x": 6,
        "y": 0
      },
      "id": 11,
      "options": {
        "footer": {
          "enablePagination": false,
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "frameIndex": 2,
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "9.0.5",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "node_uname_info",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "__auto",
          "range": false,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "count by (node) (node_cpu_seconds_total{mode=\"idle\"})",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "CPUs",
          "range": false,
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "sum by (node) (node_memory_MemTotal_bytes)",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "Memory",
          "range": false,
          "refId": "C"
        }
      ],
      "title": "Cluster Nodes",
      "transformations": [
        {
          "id": "seriesToColumns",
          "options": {
            "byField": "node"
          }
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "Memory (GB)",
            "binary": {
              "left": "Value #C",
              "operator": "/",
              "reducer": "sum",
              "right": "1073741824"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            }
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "Time 2": true,
              "Value #A": true,
              "Value #C": true,
              "__name__": true,
              "app": true,
              "app_kubernetes_io_managed_by": true,
              "chart": true,
              "component": true,
              "domainname": true,
              "heritage": true,
              "instance": true,
              "job": true,
              "namespace": true,
              "node": false,
              "nodename": true,
              "release": false,
              "service": true,
              "sysname": true,
              "version": true
            },
            "indexByName": {
              "Memory (GB)": 23,
              "Time 1": 1,
              "Time 2": 19,
              "Time 3": 21,
              "Value #A": 18,
              "Value #B": 20,
              "Value #C": 22,
              "__name__": 2,
              "app": 3,
              "app_kubernetes_io_managed_by": 4,
              "chart": 5,
              "component": 6,
              "domainname": 7,
              "heritage": 8,
              "instance": 9,
              "job": 10,
              "machine": 14,
              "namespace": 11,
              "node": 0,
              "nodename": 12,
              "release": 13,
              "service": 15,
              "sysname": 16,
              "version": 17
            },
            "renameByName": {
              "Memory (GB)": "",
              "Time": "",
              "Time 2": "",
              "Value #A": "",
              "Value #B": "CPU",
              "Value #C": "",
              "instance": "",
              "machine": "Arch",
              "node": "Hostname",
              "nodename": "",
              "release": "Linux version",
              "version": ""
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "description": "The memory usage in a cluster grouped by Kubernetes namespace",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-YlRd"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 13,
        "w": 6,
        "x": 0,
        "y": 7
      },
      "id": 10,
      "options": {
        "displayMode": "gradient",
        "minVizHeight": 20,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "text": {}
      },
      "pluginVersion": "9.0.5",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "sort_desc(sum by (namespace) (container_memory_working_set_bytes{pod!=\"\",container!=\"POD\", container!=\"\"}))",
          "format": "time_series",
          "instant": true,
          "interval": "",
          "legendFormat": "{{ namespace }}",
          "range": false,
          "refId": "A"
        }
      ],
      "title": "Memory usage by namespace",
      "transformations": [],
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "description": "The memory usage in a cluster grouped by Kubernetes deployment",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-YlRd"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 13,
        "w": 7,
        "x": 6,
        "y": 7
      },
      "id": 8,
      "options": {
        "displayMode": "gradient",
        "minVizHeight": 20,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "text": {}
      },
      "pluginVersion": "9.0.5",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "sort_desc(sum by (container, namespace) (container_memory_working_set_bytes{container!=\"POD\", container!=\"\"}))",
          "format": "time_series",
          "instant": true,
          "interval": "",
          "legendFormat": "{{ namespace }} - {{ container}}",
          "range": false,
          "refId": "A"
        }
      ],
      "title": "Memory usage by deployment",
      "transformations": [],
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "description": "The memory usage in a cluster grouped by Kubernetes pod",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-YlRd"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 13,
        "w": 7,
        "x": 13,
        "y": 7
      },
      "id": 9,
      "options": {
        "displayMode": "gradient",
        "minVizHeight": 20,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "text": {}
      },
      "pluginVersion": "9.0.5",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "sort_desc(sum by (pod, namespace) (container_memory_working_set_bytes{pod!=\"\",container!=\"POD\", container!=\"\"}))",
          "format": "time_series",
          "instant": true,
          "interval": "",
          "legendFormat": "{{ namespace }} - {{ pod}}",
          "range": false,
          "refId": "A"
        }
      ],
      "title": "Memory usage by pod",
      "transformations": [],
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "description": "The CPU usage in a cluster grouped by Kubernetes namespace",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-YlRd"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 13,
        "w": 6,
        "x": 0,
        "y": 20
      },
      "id": 16,
      "options": {
        "displayMode": "gradient",
        "minVizHeight": 20,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true
      },
      "pluginVersion": "9.0.5",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "sort_desc(sum by (namespace) (rate(container_cpu_usage_seconds_total{container!=\"\", container!=\"POD\"}[5m])))",
          "format": "time_series",
          "instant": true,
          "legendFormat": "{{container}}",
          "range": false,
          "refId": "A"
        }
      ],
      "title": "CPU Usage by namespace",
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "description": "The CPU usage in a cluster grouped by Kubernetes deployment",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-YlRd"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 13,
        "w": 7,
        "x": 6,
        "y": 20
      },
      "id": 15,
      "options": {
        "displayMode": "gradient",
        "minVizHeight": 20,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true
      },
      "pluginVersion": "9.0.5",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "sort_desc(sum by (container, namespace) (rate(container_cpu_usage_seconds_total{container!=\"\", container!=\"POD\"}[5m])))",
          "format": "time_series",
          "instant": true,
          "legendFormat": "{{ namespace }} - {{container}}",
          "range": false,
          "refId": "A"
        }
      ],
      "title": "CPU Usage by deployment",
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "description": "The CPU usage in a cluster grouped by Kubernetes pod",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-YlRd"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 13,
        "w": 7,
        "x": 13,
        "y": 20
      },
      "id": 17,
      "options": {
        "displayMode": "gradient",
        "minVizHeight": 20,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true
      },
      "pluginVersion": "9.0.5",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "sort_desc(sum by (pod, namespace) (rate(container_cpu_usage_seconds_total{container!=\"\", container!=\"POD\"}[5m])))",
          "format": "time_series",
          "instant": true,
          "legendFormat": "{{ namespace }} - {{ pod}}",
          "range": false,
          "refId": "A"
        }
      ],
      "title": "CPU Usage by pod",
      "type": "bargauge"
    }
  ],
  "refresh": false,
  "schemaVersion": 36,
  "style": "dark",
  "tags": [
    "kubernetes",
    "prometheus",
    "node exporter",
    "cadvisor",
    "utilization",
    "ram",
    "cpu"
  ],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Kubernetes Cluster for RAM and CPU Utilization",
  "uid": "gzIcCaiVz",
  "version": 13,
  "weekStart": "",
  "gnetId": 16734
}