updated monitoring stack for k3s and added kube dashboards

This commit is contained in:
rezayaghobi-dev
2026-08-16 22:26:40 +03:30
parent 4acb8b5ac1
commit d5bc686665
10 changed files with 8131 additions and 43 deletions

View File

@@ -0,0 +1,574 @@
{
"apiVersion": "dashboard.grafana.app/v2",
"kind": "Dashboard",
"metadata": {
"name": "k3s-unified-custom",
"namespace": "default",
"uid": "bdd5aead-f832-414c-ae5a-d78512b329bc",
"resourceVersion": "1786873984999019",
"generation": 1,
"creationTimestamp": "2026-08-16T09:53:04Z",
"labels": {
"grafana.app/deprecatedInternalID": "3760385721421824"
},
"annotations": {
"grafana.app/createdBy": "user:dfbtp4cn32dj4f",
"grafana.app/folder": "",
"grafana.app/saved-from-ui": "Grafana v13.1.1 (a9cee6e172)"
}
},
"spec": {
"annotations": [
{
"kind": "AnnotationQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "grafana",
"version": "v0",
"datasource": {
"name": "-- Grafana --"
},
"spec": {}
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"builtIn": true,
"legacyOptions": {
"type": "dashboard"
}
}
}
],
"cursorSync": "Off",
"editable": true,
"elements": {
"panel-1": {
"kind": "Panel",
"spec": {
"id": 1,
"title": "Running Pods",
"description": "",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "${DS_PROMETHEUS}"
},
"spec": {
"expr": "sum(kube_pod_status_phase{namespace=~\"$namespace\", pod=~\"$pod\", phase=\"Running\"})"
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "stat",
"version": "",
"spec": {
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "fixed",
"fixedColor": "green"
}
},
"overrides": []
}
}
}
}
},
"panel-2": {
"kind": "Panel",
"spec": {
"id": 2,
"title": "Problem Pods",
"description": "",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "${DS_PROMETHEUS}"
},
"spec": {
"expr": "sum(kube_pod_status_phase{namespace=~\"$namespace\", pod=~\"$pod\", phase=~\"Failed|Pending|Unknown\"})"
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "stat",
"version": "",
"spec": {
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "fixed",
"fixedColor": "red"
}
},
"overrides": []
}
}
}
}
},
"panel-3": {
"kind": "Panel",
"spec": {
"id": 3,
"title": "Pod CPU Usage",
"description": "",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "${DS_PROMETHEUS}"
},
"spec": {
"expr": "sum by (pod) (rate(container_cpu_usage_seconds_total{namespace=~\"$namespace\", pod=~\"$pod\", image!=\"\"}[$__rate_interval]))",
"legendFormat": "{{pod}}"
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "timeseries",
"version": "",
"spec": {
"options": {},
"fieldConfig": {
"defaults": {},
"overrides": []
}
}
}
}
},
"panel-4": {
"kind": "Panel",
"spec": {
"id": 4,
"title": "Pod Memory Usage",
"description": "",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "${DS_PROMETHEUS}"
},
"spec": {
"expr": "sum by (pod) (container_memory_working_set_bytes{namespace=~\"$namespace\", pod=~\"$pod\", image!=\"\"})",
"legendFormat": "{{pod}}"
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "timeseries",
"version": "",
"spec": {
"options": {},
"fieldConfig": {
"defaults": {
"unit": "bytes"
},
"overrides": []
}
}
}
}
},
"panel-5": {
"kind": "Panel",
"spec": {
"id": 5,
"title": "Live Pod Logs",
"description": "",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "loki",
"version": "v0",
"datasource": {
"name": "${DS_LOKI}"
},
"spec": {
"expr": "{cluster=\"k3s-homeserver\", namespace=~\"$namespace\", pod=~\"$pod\"} |~ \"$search\""
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "logs",
"version": "",
"spec": {
"options": {
"showLabels": true,
"showTime": true,
"wrapLogMessage": true
},
"fieldConfig": {
"defaults": {},
"overrides": []
}
}
}
}
}
},
"layout": {
"kind": "RowsLayout",
"spec": {
"rows": [
{
"kind": "RowsLayoutRow",
"spec": {
"title": "K3s Cluster Status (kube-state-metrics)",
"collapse": false,
"layout": {
"kind": "GridLayout",
"spec": {
"items": [
{
"kind": "GridLayoutItem",
"spec": {
"x": 0,
"y": 0,
"width": 12,
"height": 5,
"element": {
"kind": "ElementReference",
"name": "panel-1"
}
}
},
{
"kind": "GridLayoutItem",
"spec": {
"x": 12,
"y": 0,
"width": 12,
"height": 5,
"element": {
"kind": "ElementReference",
"name": "panel-2"
}
}
}
]
}
}
}
},
{
"kind": "RowsLayoutRow",
"spec": {
"title": "K3s Compute (cAdvisor)",
"collapse": false,
"layout": {
"kind": "GridLayout",
"spec": {
"items": [
{
"kind": "GridLayoutItem",
"spec": {
"x": 0,
"y": 0,
"width": 12,
"height": 7,
"element": {
"kind": "ElementReference",
"name": "panel-3"
}
}
},
{
"kind": "GridLayoutItem",
"spec": {
"x": 12,
"y": 0,
"width": 12,
"height": 7,
"element": {
"kind": "ElementReference",
"name": "panel-4"
}
}
}
]
}
}
}
},
{
"kind": "RowsLayoutRow",
"spec": {
"title": "K3s Logs (Loki + Alloy)",
"collapse": false,
"layout": {
"kind": "GridLayout",
"spec": {
"items": [
{
"kind": "GridLayoutItem",
"spec": {
"x": 0,
"y": 0,
"width": 24,
"height": 14,
"element": {
"kind": "ElementReference",
"name": "panel-5"
}
}
}
]
}
}
}
}
]
}
},
"links": [],
"liveNow": false,
"preload": false,
"tags": [],
"timeSettings": {
"from": "now-1h",
"to": "now",
"autoRefresh": "",
"autoRefreshIntervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"hideTimepicker": false,
"fiscalYearStartMonth": 0
},
"title": "K3s Unified Application Dashboard",
"variables": [
{
"kind": "DatasourceVariable",
"spec": {
"name": "DS_PROMETHEUS",
"pluginId": "prometheus",
"refresh": "never",
"regex": "",
"current": {
"text": "",
"value": ""
},
"options": [],
"multi": false,
"includeAll": false,
"label": "Prometheus Data Source",
"hide": "dontHide",
"skipUrlSync": false,
"allowCustomValue": true
}
},
{
"kind": "DatasourceVariable",
"spec": {
"name": "DS_LOKI",
"pluginId": "loki",
"refresh": "never",
"regex": "",
"current": {
"text": "",
"value": ""
},
"options": [],
"multi": false,
"includeAll": false,
"label": "Loki Data Source",
"hide": "dontHide",
"skipUrlSync": false,
"allowCustomValue": true
}
},
{
"kind": "QueryVariable",
"spec": {
"name": "namespace",
"current": {
"text": "",
"value": ""
},
"label": "Namespace",
"hide": "dontHide",
"refresh": "onDashboardLoad",
"skipUrlSync": false,
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "${DS_PROMETHEUS}"
},
"spec": {
"__legacyStringValue": "label_values(kube_pod_info, namespace)"
}
},
"regex": "",
"sort": "disabled",
"options": [],
"multi": true,
"includeAll": true,
"allValue": ".*",
"allowCustomValue": true
}
},
{
"kind": "QueryVariable",
"spec": {
"name": "pod",
"current": {
"text": "",
"value": ""
},
"label": "Pod",
"hide": "dontHide",
"refresh": "onDashboardLoad",
"skipUrlSync": false,
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "${DS_PROMETHEUS}"
},
"spec": {
"__legacyStringValue": "label_values(kube_pod_info{namespace=~\"$namespace\"}, pod)"
}
},
"regex": "",
"sort": "disabled",
"options": [],
"multi": true,
"includeAll": true,
"allValue": ".*",
"allowCustomValue": true
}
},
{
"kind": "TextVariable",
"spec": {
"name": "search",
"current": {
"text": "",
"value": ""
},
"query": "",
"label": "Log String Filter",
"hide": "dontHide",
"skipUrlSync": false
}
}
]
}
}