From 07b3601206569b36ccf30277b3bc473f997d4e7d Mon Sep 17 00:00:00 2001 From: root Date: Fri, 27 Mar 2026 09:06:19 -0500 Subject: [PATCH] feat: add top-5 fullest PVs panel to Kubernetes dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a horizontal bar gauge showing the disk usage % of the 5 most-full PersistentVolumes in the cluster, using kubelet volume stats already scraped by Prometheus: topk(5, kubelet_volume_stats_used_bytes / kubelet_volume_stats_capacity_bytes * 100) Labels show namespace/PVC name. Color thresholds: green <70%, yellow 70–90%, red >90%. Placed at the bottom of the dashboard (y=46). Bump dashboard version to 3. --- hosts/unstable/hosea/default.nix | 37 +++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/hosts/unstable/hosea/default.nix b/hosts/unstable/hosea/default.nix index e6c3e1b..a9a06a5 100644 --- a/hosts/unstable/hosea/default.nix +++ b/hosts/unstable/hosea/default.nix @@ -285,7 +285,7 @@ in "uid": "kubernetes-overview", "title": "Kubernetes Overview", "schemaVersion": 38, - "version": 2, + "version": 3, "refresh": "30s", "time": {"from": "now-3h", "to": "now"}, "panels": [ @@ -390,6 +390,41 @@ in "title": "Node Memory Usage %", "gridPos": {"x": 12, "y": 38, "w": 12, "h": 8}, "targets": [{"datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "(1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 100", "refId": "A"}] + }, + { + "id": 12, + "type": "bargauge", + "title": "Top 5 Fullest PersistentVolumes", + "gridPos": {"x": 0, "y": 46, "w": 24, "h": 8}, + "targets": [ + { + "datasource": {"type": "prometheus", "uid": "prometheus"}, + "expr": "topk(5, kubelet_volume_stats_used_bytes / kubelet_volume_stats_capacity_bytes * 100)", + "legendFormat": "{{namespace}}/{{persistentvolumeclaim}}", + "refId": "A", + "instant": true + } + ], + "options": { + "reduceOptions": {"calcs": ["lastNotNull"]}, + "orientation": "horizontal", + "displayMode": "gradient" + }, + "fieldConfig": { + "defaults": { + "unit": "percent", + "min": 0, + "max": 100, + "thresholds": { + "mode": "absolute", + "steps": [ + {"color": "green", "value": null}, + {"color": "yellow", "value": 70}, + {"color": "red", "value": 90} + ] + } + } + } } ] }