Files
ljwx-k8s/kubernetes-overview-dashboard.json
2026-02-20 22:50:45 +08:00

396 lines
9.9 KiB
JSON

{
"dashboard": {
"id": null,
"title": "Kubernetes Cluster Overview",
"tags": ["kubernetes", "overview", "monitoring"],
"timezone": "browser",
"time": {
"from": "now-6h",
"to": "now"
},
"refresh": "30s",
"schemaVersion": 27,
"version": 1,
"panels": [
{
"id": 1,
"title": "Cluster Summary",
"type": "stat",
"gridPos": {"h": 8, "w": 3, "x": 0, "y": 0},
"targets": [
{
"expr": "count(kube_node_status_condition{condition=\"Ready\",status=\"true\"})",
"refId": "A"
}
],
"fieldConfig": {
"defaults": {
"displayName": "Ready Nodes",
"color": {
"mode": "thresholds"
},
"thresholds": {
"steps": [
{"color": "red", "value": null},
{"color": "green", "value": 1}
]
}
}
},
"reduceOptions": {
"values": false,
"calcs": ["lastNotNull"]
}
},
{
"id": 2,
"title": "Pod Count",
"type": "stat",
"gridPos": {"h": 8, "w": 3, "x": 3, "y": 0},
"targets": [
{
"expr": "count(kube_pod_info)",
"refId": "A"
}
],
"fieldConfig": {
"defaults": {
"displayName": "Total Pods",
"color": {
"mode": "thresholds"
},
"thresholds": {
"steps": [
{"color": "blue", "value": null}
]
}
}
},
"reduceOptions": {
"values": false,
"calcs": ["lastNotNull"]
}
},
{
"id": 3,
"title": "CPU Usage",
"type": "gauge",
"gridPos": {"h": 8, "w": 6, "x": 6, "y": 0},
"targets": [
{
"expr": "sum(rate(container_cpu_usage_seconds_total[5m])) / sum(kube_node_status_allocatable{resource=\"cpu\"}) * 100",
"refId": "A"
}
],
"fieldConfig": {
"defaults": {
"unit": "percent",
"min": 0,
"max": 100,
"color": {
"mode": "thresholds"
},
"thresholds": {
"steps": [
{"color": "green", "value": null},
{"color": "yellow", "value": 70},
{"color": "red", "value": 85}
]
}
}
},
"reduceOptions": {
"values": false,
"calcs": ["lastNotNull"]
}
},
{
"id": 4,
"title": "Memory Usage",
"type": "gauge",
"gridPos": {"h": 8, "w": 6, "x": 12, "y": 0},
"targets": [
{
"expr": "sum(container_memory_working_set_bytes) / sum(kube_node_status_allocatable{resource=\"memory\"}) * 100",
"refId": "A"
}
],
"fieldConfig": {
"defaults": {
"unit": "percent",
"min": 0,
"max": 100,
"color": {
"mode": "thresholds"
},
"thresholds": {
"steps": [
{"color": "green", "value": null},
{"color": "yellow", "value": 70},
{"color": "red", "value": 85}
]
}
}
},
"reduceOptions": {
"values": false,
"calcs": ["lastNotNull"]
}
},
{
"id": 5,
"title": "Pod Status",
"type": "stat",
"gridPos": {"h": 8, "w": 6, "x": 18, "y": 0},
"targets": [
{
"expr": "sum(kube_pod_status_phase{phase=\"Running\"})",
"legendFormat": "Running",
"refId": "A"
},
{
"expr": "sum(kube_pod_status_phase{phase=\"Pending\"})",
"legendFormat": "Pending",
"refId": "B"
},
{
"expr": "sum(kube_pod_status_phase{phase=\"Failed\"})",
"legendFormat": "Failed",
"refId": "C"
}
],
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"thresholds": {
"steps": [
{"color": "green", "value": null}
]
}
}
},
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "vertical",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": true
},
"text": {}
},
"reduceOptions": {
"values": true,
"calcs": ["lastNotNull"]
}
},
{
"id": 6,
"title": "CPU Usage by Namespace",
"type": "timeseries",
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 8},
"targets": [
{
"expr": "sum(rate(container_cpu_usage_seconds_total{container!=\"POD\",container!=\"\"}[5m])) by (namespace)",
"legendFormat": "{{namespace}}",
"refId": "A"
}
],
"fieldConfig": {
"defaults": {
"unit": "short",
"color": {
"mode": "palette-classic"
}
}
},
"options": {
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 7,
"title": "Memory Usage by Namespace",
"type": "timeseries",
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 8},
"targets": [
{
"expr": "sum(container_memory_working_set_bytes{container!=\"POD\",container!=\"\"}) by (namespace)",
"legendFormat": "{{namespace}}",
"refId": "A"
}
],
"fieldConfig": {
"defaults": {
"unit": "bytes",
"color": {
"mode": "palette-classic"
}
}
},
"options": {
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 8,
"title": "Pod Status by Namespace",
"type": "timeseries",
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 16},
"targets": [
{
"expr": "sum(kube_pod_status_phase) by (namespace, phase)",
"legendFormat": "{{namespace}} - {{phase}}",
"refId": "A"
}
],
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
}
}
},
"options": {
"tooltip": {
"mode": "multi",
"sort": "none"
}
}
},
{
"id": 9,
"title": "Pod Restarts",
"type": "timeseries",
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 16},
"targets": [
{
"expr": "increase(kube_pod_container_status_restarts_total[10m]) > 0",
"legendFormat": "{{namespace}}/{{pod}}",
"refId": "A"
}
],
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
}
}
},
"options": {
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 10,
"title": "Network I/O",
"type": "timeseries",
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 24},
"targets": [
{
"expr": "sum(rate(container_network_receive_bytes_total[5m])) by (namespace)",
"legendFormat": "RX {{namespace}}",
"refId": "A"
},
{
"expr": "sum(rate(container_network_transmit_bytes_total[5m])) by (namespace)",
"legendFormat": "TX {{namespace}}",
"refId": "B"
}
],
"fieldConfig": {
"defaults": {
"unit": "Bps",
"color": {
"mode": "palette-classic"
}
}
},
"options": {
"tooltip": {
"mode": "multi",
"sort": "none"
}
}
},
{
"id": 11,
"title": "Storage Usage",
"type": "timeseries",
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 24},
"targets": [
{
"expr": "sum(kubelet_volume_stats_used_bytes) by (namespace)",
"legendFormat": "Used - {{namespace}}",
"refId": "A"
},
{
"expr": "sum(kubelet_volume_stats_capacity_bytes) by (namespace)",
"legendFormat": "Capacity - {{namespace}}",
"refId": "B"
}
],
"fieldConfig": {
"defaults": {
"unit": "bytes",
"color": {
"mode": "palette-classic"
}
}
},
"options": {
"tooltip": {
"mode": "multi",
"sort": "none"
}
}
}
],
"templating": {
"list": [
{
"name": "namespace",
"type": "query",
"query": "label_values(kube_pod_info, namespace)",
"refresh": 1,
"includeAll": true,
"allValue": ".*",
"multi": true,
"current": {
"selected": true,
"text": ["All"],
"value": ["$__all"]
}
}
]
},
"annotations": {
"list": [
{
"name": "Kubernetes Events",
"type": "dashboard",
"iconColor": "red",
"tags": ["kubernetes", "event"]
}
]
},
"links": [],
"timepicker": {
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
},
"description": "Kubernetes cluster overview dashboard"
}
}