From 649d56164c6c27afaef8fefba4711d4f61e3e159 Mon Sep 17 00:00:00 2001 From: Endre Kadas Date: Mon, 6 Jan 2025 16:21:17 +0000 Subject: [PATCH 1/2] feat: Add some kubernetes dashboards --- dashboards/all-namespaces.dashboard.json | 825 +++++++++++++++++ dashboards/namespace.dashboard.json | 1075 ++++++++++++++++++++++ 2 files changed, 1900 insertions(+) create mode 100644 dashboards/all-namespaces.dashboard.json create mode 100644 dashboards/namespace.dashboard.json diff --git a/dashboards/all-namespaces.dashboard.json b/dashboards/all-namespaces.dashboard.json new file mode 100644 index 0000000..c997a03 --- /dev/null +++ b/dashboards/all-namespaces.dashboard.json @@ -0,0 +1,825 @@ +{ + "version": 3, + "dashboardId": "7171349160317164441", + "title": "All namespaces", + "description": "Metrics (CPU, Memory, Network) and events for all namespaces.", + "role": "", + "owner": "", + "created": "2024-03-07T05:42:22.591Z", + "tabs": [ + { + "tabId": "default", + "name": "Metrics", + "panels": [ + { + "id": "Panel_ID3097710", + "type": "area-stacked", + "title": "Memory usage", + "description": "The amount of memory being used by each Kubernetes pod.", + "config": { + "show_legends": true, + "legends_position": "right", + "unit": "bytes", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "sum(k8s_pod_memory_usage{}) by (k8s_namespace_name)", + "customQuery": true, + "fields": { + "stream": "k8s_pod_memory_rss", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "filter": [] + }, + "config": { + "promql_legend": "{k8s_namespace_name}", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 24, + "y": 0, + "w": 24, + "h": 6, + "i": 6 + } + }, + { + "id": "Panel_ID6215710", + "type": "area-stacked", + "title": "CPU utilization", + "description": "The amount of CPU used by resources in each namespace in the cluster. CPU is reported as the average core usage measured in cpu units. 1 cpu, in Kubernetes, is equivalent to 1 vCPU/Core for cloud providers, and 1 hyper-thread on bare-metal Intel processors.", + "config": { + "show_legends": true, + "legends_position": "right", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "sum(k8s_pod_cpu_utilization{}) by (k8s_namespace_name)", + "customQuery": true, + "fields": { + "stream": "k8s_pod_cpu_utilization", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "filter": [] + }, + "config": { + "promql_legend": "{k8s_namespace_name}", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 0, + "y": 0, + "w": 24, + "h": 6, + "i": 7 + } + }, + { + "id": "Panel_ID62210", + "type": "line", + "title": "Storage: PVC usage (%)", + "description": "Storage utilized on the persistent volume claims.", + "config": { + "show_legends": true, + "legends_position": "bottom", + "unit": "percent-1", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "(\n sum by(k8s_namespace_name)(\n k8s_volume_capacity{k8s_persistentvolumeclaim_name!=\"\"}\n - k8s_volume_available{k8s_persistentvolumeclaim_name!=\"\"}\n )\n) / (\n sum by(k8s_namespace_name)(\n k8s_volume_capacity{k8s_persistentvolumeclaim_name!=\"\"}\n )\n)\n", + "customQuery": true, + "fields": { + "stream": "k8s_volume_capacity", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "filter": [] + }, + "config": { + "promql_legend": "{k8s_namespace_name}", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 0, + "y": 18, + "w": 16, + "h": 6, + "i": 8 + } + }, + { + "id": "Panel_ID4566510", + "type": "area-stacked", + "title": "Network: Receive bandwidth (primary interface)", + "description": "", + "config": { + "show_legends": true, + "legends_position": "right", + "unit": "bps", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "sum(irate(k8s_pod_network_io{direction=\"receive\", direction=\"receive\"}[5m])) by (k8s_namespace_name)", + "customQuery": true, + "fields": { + "stream": "k8s_pod_network_io", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "filter": [] + }, + "config": { + "promql_legend": "{k8s_namespace_name}", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 0, + "y": 24, + "w": 24, + "h": 7, + "i": 9 + } + }, + { + "id": "Panel_ID400510", + "type": "area-stacked", + "title": "Network: Transmit bandwidth (primary interface)", + "description": "", + "config": { + "show_legends": true, + "legends_position": "right", + "unit": "bps", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "sum(irate(k8s_pod_network_io{direction=\"transmit\"}[5m])) by(k8s_namespace_name)", + "customQuery": true, + "fields": { + "stream": "k8s_pod_network_io", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "filter": [] + }, + "config": { + "promql_legend": "{k8s_namespace_name}", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 24, + "y": 24, + "w": 24, + "h": 7, + "i": 10 + } + }, + { + "id": "Panel_ID2258110", + "type": "area-stacked", + "title": "Storage: IOPS(Reads+Writes)", + "description": "", + "config": { + "show_legends": true, + "legends_position": null, + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "ceil(sum by(namespace) (rate(container_fs_reads_total{container!=\"\", device=~\"(/dev/)?(mmcblk.p.+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|md.+|dasd.+)\"}[$__rate_interval]) + rate(container_fs_writes_total{container!=\"\", device=~\"(/dev/)?(mmcblk.p.+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|md.+|dasd.+)\",}[$__rate_interval])))", + "customQuery": true, + "fields": { + "stream": "container_fs_reads_total", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "filter": [] + }, + "config": { + "promql_legend": "{namespace}", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 16, + "y": 18, + "w": 16, + "h": 6, + "i": 11 + } + }, + { + "id": "Panel_ID2533410", + "type": "area-stacked", + "title": "Storage: ThroughPut(Read+Write)", + "description": "", + "config": { + "show_legends": true, + "legends_position": null, + "unit": "bps", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "sum by(namespace)(\n rate(container_fs_reads_bytes_total{\n container!= \"\",\n device=~\"(/dev/)?(mmcblk[0-9]p[0-9]+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|md.+|dasd.+)\"\n }[$__rate_interval])\n +\n rate(container_fs_writes_bytes_total{\n container!= \"\",\n device=~\"(/dev/)?(mmcblk[0-9]p[0-9]+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|md.+|dasd.+)\"\n }[$__rate_interval])\n)", + "customQuery": true, + "fields": { + "stream": "cadvisor_version_info", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "filter": [] + }, + "config": { + "promql_legend": "{namespace}", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 32, + "y": 18, + "w": 16, + "h": 6, + "i": 12 + } + }, + { + "id": "Panel_ID1364410", + "type": "line", + "title": "CPU Utilization (From Limits)", + "description": "When a CPU Limit is present in a pod configuration, this chart shows how much CPU each pod uses as a percentage against that limit.", + "config": { + "show_legends": true, + "legends_position": "right", + "unit": "percent-1", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "sum(k8s_pod_cpu_limit_utilization{}) by (k8s_namespace_name)", + "customQuery": true, + "fields": { + "stream": "k8s_pod_cpu_limit_utilization", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "filter": [] + }, + "config": { + "promql_legend": "{k8s_namespace_name}", + "layer_type": "scatter", + "weight_fixed": 1, + "limit": 0, + "min": 0, + "max": 100 + } + } + ], + "layout": { + "x": 0, + "y": 6, + "w": 24, + "h": 6, + "i": 13 + } + }, + { + "id": "Panel_ID3607010", + "type": "line", + "title": "CPU Utilization (From Requests)", + "description": "When a CPU Request is present in a pod configuration, this chart shows how much CPU each pod uses as a percentage against that request.", + "config": { + "show_legends": true, + "legends_position": "right", + "unit": "percent-1", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "sum(k8s_pod_cpu_request_utilization{}) by (k8s_namespace_name)", + "customQuery": true, + "fields": { + "stream": "k8s_pod_cpu_request_utilization", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "filter": [] + }, + "config": { + "promql_legend": "{k8s_namespace_name}", + "layer_type": "scatter", + "weight_fixed": 1, + "limit": 0, + "min": 0, + "max": 100 + } + } + ], + "layout": { + "x": 0, + "y": 12, + "w": 24, + "h": 6, + "i": 14 + } + }, + { + "id": "Panel_ID4327510", + "type": "line", + "title": "Memory Utilization (From Requests)", + "description": "When a Memory Request is present in a pod configuration, this chart shows how much memory each pod uses as a percentage against that request value.", + "config": { + "show_legends": true, + "legends_position": "right", + "unit": "percent-1", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "sum(k8s_pod_memory_request_utilization{}) by (k8s_namespace_name)", + "customQuery": true, + "fields": { + "stream": "k8s_pod_memory_request_utilization", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "filter": [] + }, + "config": { + "promql_legend": "{k8s_namespace_name}", + "layer_type": "scatter", + "weight_fixed": 1, + "limit": 0, + "min": 0, + "max": 100 + } + } + ], + "layout": { + "x": 24, + "y": 6, + "w": 24, + "h": 6, + "i": 15 + } + }, + { + "id": "Panel_ID1975310", + "type": "line", + "title": "Memory Utilization (From Limits)", + "description": "When a Memory Limit is present in a pod configuration, this chart shows how much memory each pod uses as a percentage against that limit value.", + "config": { + "show_legends": true, + "legends_position": "right", + "unit": "percent-1", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "sum(k8s_pod_memory_limit_utilization{}) by (k8s_namespace_name)", + "customQuery": true, + "fields": { + "stream": "k8s_pod_memory_limit_utilization", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "filter": [] + }, + "config": { + "promql_legend": "{k8s_namespace_name}", + "layer_type": "scatter", + "weight_fixed": 1, + "limit": 0, + "min": 0, + "max": 100 + } + } + ], + "layout": { + "x": 24, + "y": 12, + "w": 24, + "h": 6, + "i": 16 + } + } + ] + }, + { + "tabId": "events", + "name": "Events", + "panels": [ + { + "id": "Panel_ID8993010", + "type": "donut", + "title": "Severity", + "description": "", + "config": { + "show_legends": true, + "legends_position": "right", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "sql", + "queries": [ + { + "query": "SELECT severity as \"x_axis_1\", count(_timestamp) as \"y_axis_1\" FROM \"k8s_events\" GROUP BY x_axis_1 ORDER BY x_axis_1", + "customQuery": false, + "fields": { + "stream": "k8s_events", + "stream_type": "logs", + "x": [ + { + "label": "Severity", + "alias": "x_axis_1", + "column": "severity", + "color": null + } + ], + "y": [ + { + "label": "Timestamp", + "alias": "y_axis_1", + "column": "_timestamp", + "color": "#5960b2", + "aggregationFunction": "count" + } + ], + "z": [], + "filter": [] + }, + "config": { + "promql_legend": "", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 0, + "y": 0, + "w": 16, + "h": 7, + "i": 1 + } + }, + { + "id": "Panel_ID9681410", + "type": "stacked", + "title": "Severity by namespace", + "description": "", + "config": { + "show_legends": true, + "legends_position": null, + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "sql", + "queries": [ + { + "query": "SELECT k8s_namespace_name as \"x_axis_1\", severity as \"x_axis_2\", count(severity) as \"y_axis_1\" FROM \"k8s_events\" GROUP BY x_axis_1, x_axis_2 ORDER BY x_axis_1, x_axis_2", + "customQuery": false, + "fields": { + "stream": "k8s_events", + "stream_type": "logs", + "x": [ + { + "label": " ", + "alias": "x_axis_1", + "column": "k8s_namespace_name", + "color": null + }, + { + "label": "Severity", + "alias": "x_axis_2", + "column": "severity", + "color": null + } + ], + "y": [ + { + "label": " ", + "alias": "y_axis_1", + "column": "severity", + "color": "#5960b2", + "aggregationFunction": "count" + } + ], + "z": [], + "filter": [] + }, + "config": { + "promql_legend": "", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 0, + "y": 7, + "w": 48, + "h": 8, + "i": 2 + } + }, + { + "id": "Panel_ID64110", + "type": "stacked", + "title": "Event reason by namespace", + "description": "", + "config": { + "show_legends": true, + "legends_position": "bottom", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "sql", + "queries": [ + { + "query": "SELECT k8s_event_reason as \"x_axis_1\", k8s_namespace_name as \"x_axis_2\", count(_timestamp) as \"y_axis_1\" FROM \"k8s_events\" GROUP BY x_axis_1, x_axis_2 ORDER BY x_axis_1, x_axis_2", + "customQuery": false, + "fields": { + "stream": "k8s_events", + "stream_type": "logs", + "x": [ + { + "label": " ", + "alias": "x_axis_1", + "column": "k8s_event_reason", + "color": null + }, + { + "label": "K8s Namespace Name", + "alias": "x_axis_2", + "column": "k8s_namespace_name", + "color": null + } + ], + "y": [ + { + "label": " ", + "alias": "y_axis_1", + "column": "_timestamp", + "color": "#5960b2", + "aggregationFunction": "count" + } + ], + "z": [], + "filter": [] + }, + "config": { + "promql_legend": "", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 16, + "y": 0, + "w": 32, + "h": 7, + "i": 4 + } + }, + { + "id": "Panel_ID9456910", + "type": "table", + "title": "Raw data", + "description": "", + "config": { + "show_legends": true, + "legends_position": null, + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "sql", + "queries": [ + { + "query": "SELECT histogram(_timestamp) as \"x_axis_1\", k8s_namespace_name as \"x_axis_3\", k8s_object_name as \"x_axis_4\", severity as \"x_axis_5\", k8s_event_reason as \"x_axis_6\", body as \"x_axis_7\", max(k8s_event_count) as \"y_axis_1\" FROM \"k8s_events\" GROUP BY x_axis_1, x_axis_3, x_axis_4, x_axis_5, x_axis_6, x_axis_7 ORDER BY x_axis_1, x_axis_3, x_axis_4, x_axis_5, x_axis_6, x_axis_7", + "customQuery": false, + "fields": { + "stream": "k8s_events", + "stream_type": "logs", + "x": [ + { + "label": "Timestamp", + "alias": "x_axis_1", + "column": "_timestamp", + "color": null, + "aggregationFunction": "histogram" + }, + { + "label": "Namespace", + "alias": "x_axis_3", + "column": "k8s_namespace_name", + "color": null + }, + { + "label": "Object", + "alias": "x_axis_4", + "column": "k8s_object_name", + "color": null + }, + { + "label": "Severity", + "alias": "x_axis_5", + "column": "severity", + "color": null + }, + { + "label": "Reason", + "alias": "x_axis_6", + "column": "k8s_event_reason", + "color": null + }, + { + "label": "Body", + "alias": "x_axis_7", + "column": "body", + "color": null + } + ], + "y": [ + { + "label": "Count", + "alias": "y_axis_1", + "column": "k8s_event_count", + "color": "#5960b2", + "aggregationFunction": "max" + } + ], + "z": [], + "filter": [] + }, + "config": { + "promql_legend": "", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 0, + "y": 17, + "w": 48, + "h": 13, + "i": 5 + } + } + ] + } + ], + "variables": { + "list": [] + } +} diff --git a/dashboards/namespace.dashboard.json b/dashboards/namespace.dashboard.json new file mode 100644 index 0000000..0a2e0e0 --- /dev/null +++ b/dashboards/namespace.dashboard.json @@ -0,0 +1,1075 @@ +{ + "version": 5, + "dashboardId": "7282041446872384454", + "title": "Namespace", + "description": "Metrics and objects within a namespace", + "role": "", + "owner": "", + "created": "2025-01-06T15:15:53.990Z", + "tabs": [ + { + "tabId": "default", + "name": "Metrics", + "panels": [ + { + "id": "Panel_ID3097710", + "type": "area-stacked", + "title": "Memory usage", + "description": "The amount of memory being used by each Kubernetes pod.", + "config": { + "show_legends": true, + "legends_position": "right", + "unit": "bytes", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "k8s_pod_memory_usage{k8s_namespace_name=\"$k8s_namespace_name\"}", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "k8s_pod_memory_rss", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "{k8s_pod_name}", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 24, + "y": 0, + "w": 24, + "h": 6, + "i": 6 + } + }, + { + "id": "Panel_ID6215710", + "type": "area-stacked", + "title": "CPU utilization", + "description": "The amount of CPU used by each pod in the cluster. CPU is reported as the average core usage measured in cpu units. 1 cpu, in Kubernetes, is equivalent to 1 vCPU/Core for cloud providers, and 1 hyper-thread on bare-metal Intel processors.", + "config": { + "show_legends": true, + "legends_position": "right", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "k8s_pod_cpu_utilization{k8s_namespace_name=\"$k8s_namespace_name\"}", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "k8s_pod_cpu_utilization", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "{k8s_pod_name}", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 0, + "y": 0, + "w": 24, + "h": 6, + "i": 7 + } + }, + { + "id": "Panel_ID62210", + "type": "line", + "title": "Storage: PVC usage (%)", + "description": "", + "config": { + "show_legends": true, + "legends_position": "bottom", + "unit": "percent-1", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "(\n sum by(k8s_persistentvolumeclaim_name)(\n k8s_volume_capacity{k8s_namespace_name=\"$k8s_namespace_name\", k8s_persistentvolumeclaim_name!=\"\"}\n - k8s_volume_available{k8s_namespace_name=\"$k8s_namespace_name\", k8s_persistentvolumeclaim_name!=\"\"}\n )\n) / (\n sum by(k8s_persistentvolumeclaim_name)(\n k8s_volume_capacity{k8s_namespace_name=\"$k8s_namespace_name\", k8s_persistentvolumeclaim_name!=\"\"}\n )\n)\n", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "k8s_volume_capacity", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "{k8s_persistentvolumeclaim_name}", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 0, + "y": 18, + "w": 16, + "h": 6, + "i": 8 + } + }, + { + "id": "Panel_ID4566510", + "type": "area-stacked", + "title": "Network: Receive bandwidth (primary interface)", + "description": "", + "config": { + "show_legends": true, + "legends_position": "right", + "unit": "bps", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "irate(k8s_pod_network_io{direction=\"receive\", k8s_namespace_name=\"$k8s_namespace_name\", direction=\"receive\"}[5m])", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "k8s_pod_network_io", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "{k8s_pod_name}", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 0, + "y": 24, + "w": 24, + "h": 7, + "i": 9 + } + }, + { + "id": "Panel_ID400510", + "type": "area-stacked", + "title": "Network: Transmit bandwidth (primary interface)", + "description": "", + "config": { + "show_legends": true, + "legends_position": "right", + "unit": "bps", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "irate(k8s_pod_network_io{direction=\"transmit\", k8s_namespace_name=\"$k8s_namespace_name\"}[5m])", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "k8s_pod_network_io", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "{k8s_pod_name}", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 24, + "y": 24, + "w": 24, + "h": 7, + "i": 10 + } + }, + { + "id": "Panel_ID2258110", + "type": "area-stacked", + "title": "Storage: IOPS(Reads+Writes)", + "description": "", + "config": { + "show_legends": true, + "legends_position": null, + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "ceil(sum by(pod) (rate(container_fs_reads_total{container!=\"\", device=~\"(/dev/)?(mmcblk.p.+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|md.+|dasd.+)\", namespace=\"$k8s_namespace_name\"}[$__rate_interval]) + rate(container_fs_writes_total{container!=\"\", device=~\"(/dev/)?(mmcblk.p.+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|md.+|dasd.+)\", namespace=\"$k8s_namespace_name\"}[$__rate_interval])))", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "cadvisor_version_info", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "{pod}", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 16, + "y": 18, + "w": 16, + "h": 6, + "i": 11 + } + }, + { + "id": "Panel_ID2533410", + "type": "area-stacked", + "title": "Storage: ThroughPut(Read+Write)", + "description": "", + "config": { + "show_legends": true, + "legends_position": null, + "unit": "bps", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "sum by(pod)(\n rate(container_fs_reads_bytes_total{\n container!= \"\",\n device=~\"(/dev/)?(mmcblk[0-9]p[0-9]+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|md.+|dasd.+)\",\n namespace=\"$k8s_namespace_name\"\n }[$__rate_interval])\n +\n rate(container_fs_writes_bytes_total{\n container!= \"\",\n device=~\"(/dev/)?(mmcblk[0-9]p[0-9]+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|md.+|dasd.+)\",\n namespace=\"$k8s_namespace_name\"\n }[$__rate_interval])\n)", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "cadvisor_version_info", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "{pod}", + "layer_type": "scatter", + "weight_fixed": 1 + } + } + ], + "layout": { + "x": 32, + "y": 18, + "w": 16, + "h": 6, + "i": 12 + } + }, + { + "id": "Panel_ID1364410", + "type": "line", + "title": "CPU Utilization (From Limits)", + "description": "When a CPU Limit is present in a pod configuration, this chart shows how much CPU each pod uses as a percentage against that limit.", + "config": { + "show_legends": true, + "legends_position": "right", + "unit": "percent-1", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "k8s_pod_cpu_limit_utilization{k8s_namespace_name=\"$k8s_namespace_name\"}", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "k8s_pod_cpu_limit_utilization", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "{k8s_pod_name}", + "layer_type": "scatter", + "weight_fixed": 1, + "limit": 0, + "min": 0, + "max": 100 + } + } + ], + "layout": { + "x": 0, + "y": 12, + "w": 24, + "h": 6, + "i": 13 + } + }, + { + "id": "Panel_ID3607010", + "type": "line", + "title": "CPU Utilization (From Requests)", + "description": "When a CPU Request is present in a pod configuration, this chart shows how much CPU each pod uses as a percentage against that request.", + "config": { + "show_legends": true, + "legends_position": "right", + "unit": "percent-1", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "k8s_pod_cpu_request_utilization{k8s_namespace_name=\"$k8s_namespace_name\"}", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "k8s_pod_cpu_request_utilization", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "{k8s_pod_name}", + "layer_type": "scatter", + "weight_fixed": 1, + "limit": 0, + "min": 0, + "max": 100 + } + } + ], + "layout": { + "x": 0, + "y": 6, + "w": 24, + "h": 6, + "i": 14 + } + }, + { + "id": "Panel_ID4327510", + "type": "line", + "title": "Memory Utilization (From Requests)", + "description": "When a Memory Request is present in a pod configuration, this chart shows how much memory each pod uses as a percentage against that request value.", + "config": { + "show_legends": true, + "legends_position": "right", + "unit": "percent-1", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "k8s_pod_memory_request_utilization{k8s_namespace_name=\"$k8s_namespace_name\"}", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "k8s_pod_memory_request_utilization", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "{k8s_pod_name}", + "layer_type": "scatter", + "weight_fixed": 1, + "limit": 0, + "min": 0, + "max": 100 + } + } + ], + "layout": { + "x": 24, + "y": 6, + "w": 24, + "h": 6, + "i": 15 + } + }, + { + "id": "Panel_ID1975310", + "type": "line", + "title": "Memory Utilization (From Limits)", + "description": "When a Memory Limit is present in a pod configuration, this chart shows how much memory each pod uses as a percentage against that limit value.", + "config": { + "show_legends": true, + "legends_position": "right", + "unit": "percent-1", + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "promql", + "queries": [ + { + "query": "k8s_pod_memory_limit_utilization{k8s_namespace_name=\"$k8s_namespace_name\"}", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "k8s_pod_memory_limit_utilization", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "{k8s_pod_name}", + "layer_type": "scatter", + "weight_fixed": 1, + "limit": 0, + "min": 0, + "max": 100 + } + } + ], + "layout": { + "x": 24, + "y": 12, + "w": 24, + "h": 6, + "i": 16 + } + } + ] + }, + { + "tabId": "12345", + "name": "Objects", + "panels": [ + { + "id": "Panel_ID9755810", + "type": "gauge", + "title": "Deployments", + "description": "", + "config": { + "show_legends": true, + "legends_position": null, + "unit": "numbers", + "decimals": 0, + "top_results_others": false, + "axis_border_show": false, + "label_option": { + "rotate": 0 + }, + "show_symbol": false, + "line_interpolation": "smooth", + "legend_width": { + "unit": "px" + }, + "base_map": { + "type": "osm" + }, + "map_type": { + "type": "world" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + }, + "map_symbol_style": { + "size": "by Value", + "size_by_value": { + "min": 1, + "max": 100 + }, + "size_fixed": 2 + }, + "drilldown": [], + "connect_nulls": false, + "no_value_replacement": "", + "wrap_table_cells": false, + "table_transpose": false, + "table_dynamic_columns": false, + "color": { + "mode": "palette-classic-by-series", + "fixedColor": [], + "seriesBy": "last" + } + }, + "queryType": "promql", + "queries": [ + { + "query": "k8s_deployment_available{k8s_namespace_name=\"$k8s_namespace_name\"}", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "k8s_deployment_available", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "{k8s_deployment_name}", + "layer_type": "scatter", + "weight_fixed": 1, + "limit": 0, + "min": 0, + "max": 1 + } + } + ], + "layout": { + "x": 0, + "y": 0, + "w": 12, + "h": 5, + "i": 1 + }, + "htmlContent": "", + "markdownContent": "" + }, + { + "id": "Panel_ID2873410", + "type": "gauge", + "title": "Statefulsets", + "description": "", + "config": { + "show_legends": true, + "legends_position": null, + "unit": "numbers", + "decimals": 0, + "top_results_others": false, + "axis_border_show": false, + "label_option": { + "rotate": 0 + }, + "show_symbol": false, + "line_interpolation": "smooth", + "legend_width": { + "unit": "px" + }, + "base_map": { + "type": "osm" + }, + "map_type": { + "type": "world" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + }, + "map_symbol_style": { + "size": "by Value", + "size_by_value": { + "min": 1, + "max": 100 + }, + "size_fixed": 2 + }, + "drilldown": [], + "connect_nulls": false, + "no_value_replacement": "", + "wrap_table_cells": false, + "table_transpose": false, + "table_dynamic_columns": false, + "color": { + "mode": "palette-classic-by-series", + "fixedColor": [], + "seriesBy": "last" + } + }, + "queryType": "promql", + "queries": [ + { + "query": "k8s_statefulset_current_pods{k8s_namespace_name=\"$k8s_namespace_name\"}", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "k8s_statefulset_current_pods", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "{k8s_statefulset_name}", + "layer_type": "scatter", + "weight_fixed": 1, + "limit": 0, + "min": 0, + "max": 1 + } + } + ], + "layout": { + "x": 36, + "y": 0, + "w": 12, + "h": 5, + "i": 2 + }, + "htmlContent": "", + "markdownContent": "" + }, + { + "id": "Panel_ID2467010", + "type": "gauge", + "title": "Daemonsets", + "description": "", + "config": { + "show_legends": true, + "legends_position": null, + "unit": "numbers", + "decimals": 0, + "top_results_others": false, + "axis_border_show": false, + "label_option": { + "rotate": 0 + }, + "show_symbol": false, + "line_interpolation": "smooth", + "legend_width": { + "unit": "px" + }, + "base_map": { + "type": "osm" + }, + "map_type": { + "type": "world" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + }, + "map_symbol_style": { + "size": "by Value", + "size_by_value": { + "min": 1, + "max": 100 + }, + "size_fixed": 2 + }, + "drilldown": [], + "connect_nulls": false, + "no_value_replacement": "", + "wrap_table_cells": false, + "table_transpose": false, + "table_dynamic_columns": false, + "color": { + "mode": "palette-classic-by-series", + "fixedColor": [], + "seriesBy": "last" + } + }, + "queryType": "promql", + "queries": [ + { + "query": "k8s_daemonset_current_scheduled_nodes{k8s_namespace_name=\"$k8s_namespace_name\"}", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "k8s_daemonset_current_scheduled_nodes", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "{k8s_daemonset_name}", + "layer_type": "scatter", + "weight_fixed": 1, + "limit": 0, + "min": 0, + "max": 1 + } + } + ], + "layout": { + "x": 12, + "y": 0, + "w": 12, + "h": 5, + "i": 3 + }, + "htmlContent": "", + "markdownContent": "" + }, + { + "id": "Panel_ID811410", + "type": "gauge", + "title": "Cron Jobs", + "description": "", + "config": { + "show_legends": true, + "legends_position": null, + "unit": "numbers", + "decimals": 0, + "top_results_others": false, + "axis_border_show": false, + "label_option": { + "rotate": 0 + }, + "show_symbol": false, + "line_interpolation": "smooth", + "legend_width": { + "unit": "px" + }, + "base_map": { + "type": "osm" + }, + "map_type": { + "type": "world" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + }, + "map_symbol_style": { + "size": "by Value", + "size_by_value": { + "min": 1, + "max": 100 + }, + "size_fixed": 2 + }, + "drilldown": [], + "connect_nulls": false, + "no_value_replacement": "", + "wrap_table_cells": false, + "table_transpose": false, + "table_dynamic_columns": false, + "color": { + "mode": "palette-classic-by-series", + "fixedColor": [], + "seriesBy": "last" + } + }, + "queryType": "promql", + "queries": [ + { + "query": "k8s_cronjob_active_jobs{k8s_namespace_name=\"$k8s_namespace_name\"}", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "container_cpu_time", + "stream_type": "metrics", + "x": [], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "{k8s_cronjob_name}", + "layer_type": "scatter", + "weight_fixed": 1, + "limit": 0, + "min": 0, + "max": 1 + } + } + ], + "layout": { + "x": 24, + "y": 0, + "w": 12, + "h": 5, + "i": 4 + }, + "htmlContent": "", + "markdownContent": "" + }, + { + "id": "Panel_ID3051410", + "type": "table", + "title": "Events", + "description": "", + "config": { + "show_legends": true, + "legends_position": null, + "base_map": { + "type": "osm" + }, + "map_view": { + "zoom": 1, + "lat": 0, + "lng": 0 + } + }, + "queryType": "sql", + "queries": [ + { + "query": "SELECT severity as \"x_axis_1\", body as \"x_axis_2\", k8s_namespace_name as \"x_axis_3\", k8s_object_name as \"x_axis_4\", k8s_event_count as \"x_axis_5\", histogram(_timestamp) as \"x_axis_6\" FROM \"k8s_events\" where k8s_namespace_name='$k8s_namespace_name' GROUP BY x_axis_1, x_axis_2, x_axis_3, x_axis_4, x_axis_5, x_axis_6 ORDER BY x_axis_6 ASC", + "vrlFunctionQuery": null, + "customQuery": true, + "fields": { + "stream": "k8s_events", + "stream_type": "logs", + "x": [ + { + "label": "Severity", + "alias": "x_axis_1", + "column": "x_axis_1", + "color": null + }, + { + "label": "Body", + "alias": "x_axis_2", + "column": "x_axis_2", + "color": null + }, + { + "label": "K8s Namespace Name", + "alias": "x_axis_3", + "column": "x_axis_3", + "color": null + }, + { + "label": "K8s Object Name", + "alias": "x_axis_4", + "column": "x_axis_4", + "color": null + }, + { + "label": "K8s Event Count", + "alias": "x_axis_5", + "column": "x_axis_5", + "color": null + }, + { + "label": "Timestamp", + "alias": "x_axis_6", + "column": "x_axis_6", + "color": null, + "aggregationFunction": "histogram", + "sortBy": "ASC" + } + ], + "y": [], + "z": [], + "breakdown": [], + "filter": { + "filterType": "group", + "logicalOperator": "AND", + "conditions": [] + } + }, + "config": { + "promql_legend": "", + "layer_type": "scatter", + "weight_fixed": 1, + "limit": 0, + "min": 0, + "max": 100 + } + } + ], + "layout": { + "x": 0, + "y": 5, + "w": 48, + "h": 15, + "i": 5 + } + } + ] + } + ], + "variables": { + "list": [ + { + "type": "query_values", + "name": "k8s_namespace_name", + "label": "", + "query_data": { + "stream_type": "metrics", + "stream": "k8s_pod_cpu_utilization", + "field": "k8s_namespace_name", + "max_record_size": 100 + }, + "value": "", + "options": [] + } + ] + } +} From 937f3ae9583a8f5f560cdde33a44a812c0a10fc2 Mon Sep 17 00:00:00 2001 From: Endre Kadas Date: Mon, 6 Jan 2025 16:31:05 +0000 Subject: [PATCH 2/2] ci: Set up terraform --- .github/workflows/checks.yaml | 2 ++ .github/workflows/deploy.yaml | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 3c74db1..936a524 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -10,6 +10,7 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: hashicorp/setup-terraform@v3 - run: terraform fmt -check shellcheck: @@ -24,5 +25,6 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: hashicorp/setup-terraform@v3 - run: terraform init -backend=false - run: terraform validate diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 80e764c..c59ea4a 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -65,6 +65,7 @@ jobs: with: token: ${{ env.DIGITALOCEAN_ACCESS_TOKEN }} - run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 runtime-${{ inputs.environment }} + - uses: hashicorp/setup-terraform@v3 - run: ./deploy.sh working-directory: ./add-ons/services env: