feat: improve observability foundations
Deploy Cluster / Terraform (push) Successful in 37s
Deploy Cluster / Ansible (push) Successful in 24m26s

This commit is contained in:
2026-05-05 08:45:01 +00:00
parent 95c4fafd4d
commit 69eb1ef890
7 changed files with 265 additions and 61 deletions
@@ -0,0 +1,86 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-dashboard-cluster-overview
namespace: observability
labels:
grafana_dashboard: "1"
data:
cluster-overview.json: |
{
"annotations": {"list": []},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"panels": [
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
"gridPos": {"h": 5, "w": 6, "x": 0, "y": 0},
"id": 1,
"options": {"reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
"targets": [{"expr": "count(kube_node_status_condition{condition=\"Ready\",status=\"true\"})", "legendFormat": "ready", "refId": "A"}],
"title": "Ready Nodes",
"type": "stat"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
"gridPos": {"h": 5, "w": 6, "x": 6, "y": 0},
"id": 2,
"options": {"reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
"targets": [{"expr": "sum(kube_pod_status_phase{phase=\"Running\"})", "legendFormat": "running", "refId": "A"}],
"title": "Running Pods",
"type": "stat"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
"gridPos": {"h": 5, "w": 6, "x": 12, "y": 0},
"id": 3,
"options": {"reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
"targets": [{"expr": "sum(kube_pod_status_phase{phase=~\"Pending|Failed|Unknown\"})", "legendFormat": "not running", "refId": "A"}],
"title": "Pods Needing Attention",
"type": "stat"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "percentunit"}, "overrides": []},
"gridPos": {"h": 5, "w": 6, "x": 18, "y": 0},
"id": 4,
"options": {"reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
"targets": [{"expr": "1 - avg(rate(node_cpu_seconds_total{mode=\"idle\"}[5m]))", "legendFormat": "cpu", "refId": "A"}],
"title": "Cluster CPU",
"type": "stat"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "percentunit"}, "overrides": []},
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 5},
"id": 5,
"targets": [{"expr": "1 - avg(rate(node_cpu_seconds_total{mode=\"idle\"}[5m]))", "legendFormat": "cpu", "refId": "A"}],
"title": "CPU Usage",
"type": "timeseries"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "percentunit"}, "overrides": []},
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 5},
"id": 6,
"targets": [{"expr": "1 - (sum(node_memory_MemAvailable_bytes) / sum(node_memory_MemTotal_bytes))", "legendFormat": "memory", "refId": "A"}],
"title": "Memory Usage",
"type": "timeseries"
}
],
"refresh": "30s",
"schemaVersion": 39,
"tags": ["platform", "kubernetes"],
"templating": {"list": []},
"time": {"from": "now-1h", "to": "now"},
"timezone": "browser",
"title": "Platform / Cluster Overview",
"uid": "platform-cluster-overview",
"version": 1
}
@@ -0,0 +1,67 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-dashboard-flux-gitops
namespace: observability
labels:
grafana_dashboard: "1"
data:
flux-gitops.json: |
{
"annotations": {"list": []},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"panels": [
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
"gridPos": {"h": 5, "w": 8, "x": 0, "y": 0},
"id": 1,
"options": {"reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
"targets": [{"expr": "sum(kube_deployment_status_replicas_available{namespace=\"flux-system\",deployment=~\"source-controller|kustomize-controller|helm-controller|notification-controller|flux-system-weave-gitops\"})", "legendFormat": "available", "refId": "A"}],
"title": "Flux UI + Controllers Available",
"type": "stat"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
"gridPos": {"h": 5, "w": 8, "x": 8, "y": 0},
"id": 2,
"options": {"reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
"targets": [{"expr": "sum(increase(kube_pod_container_status_restarts_total{namespace=\"flux-system\"}[1h]))", "legendFormat": "restarts", "refId": "A"}],
"title": "Flux Restarts / 1h",
"type": "stat"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
"gridPos": {"h": 5, "w": 8, "x": 16, "y": 0},
"id": 3,
"options": {"reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
"targets": [{"expr": "count(kube_pod_status_phase{namespace=\"flux-system\",phase=~\"Pending|Failed|Unknown\"})", "legendFormat": "not running", "refId": "A"}],
"title": "Flux Pods Needing Attention",
"type": "stat"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
"gridPos": {"h": 8, "w": 24, "x": 0, "y": 5},
"id": 4,
"targets": [{"expr": "sum by (deployment) (kube_deployment_status_replicas_available{namespace=\"flux-system\"})", "legendFormat": "{{deployment}}", "refId": "A"}],
"title": "Flux Deployment Availability",
"type": "timeseries"
}
],
"refresh": "30s",
"schemaVersion": 39,
"tags": ["platform", "flux", "gitops"],
"templating": {"list": []},
"time": {"from": "now-1h", "to": "now"},
"timezone": "browser",
"title": "Platform / Flux GitOps",
"uid": "platform-flux-gitops",
"version": 1
}
@@ -1,60 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-dashboard-k8s-overview
namespace: observability
labels:
grafana_dashboard: "1"
data:
k8s-overview.json: |
{
"annotations": {"list": []},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"panels": [
{
"datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"},
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 0},
"id": 1,
"options": {"reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
"targets": [
{
"expr": "count(kube_node_status_condition{condition=\"Ready\",status=\"true\"})",
"legendFormat": "ready",
"refId": "A"
}
],
"title": "Ready Nodes",
"type": "stat"
},
{
"datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"},
"fieldConfig": {"defaults": {"unit": "percentunit"}, "overrides": []},
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 0},
"id": 2,
"targets": [
{
"expr": "1 - avg(rate(node_cpu_seconds_total{mode=\"idle\"}[5m]))",
"legendFormat": "cpu",
"refId": "A"
}
],
"title": "Cluster CPU Usage",
"type": "timeseries"
}
],
"refresh": "30s",
"schemaVersion": 39,
"style": "dark",
"tags": ["kubernetes", "infrastructure"],
"templating": {"list": []},
"time": {"from": "now-1h", "to": "now"},
"timezone": "browser",
"title": "K8s Cluster Overview",
"uid": "k8s-cluster-overview",
"version": 1
}
@@ -0,0 +1,86 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-dashboard-microservices-overview
namespace: observability
labels:
grafana_dashboard: "1"
data:
microservices-overview.json: |
{
"annotations": {"list": []},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"panels": [
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
"gridPos": {"h": 5, "w": 6, "x": 0, "y": 0},
"id": 1,
"options": {"reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
"targets": [{"expr": "sum(kube_deployment_status_replicas_available{namespace=\"microservices\"})", "legendFormat": "available", "refId": "A"}],
"title": "Available Replicas",
"type": "stat"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
"gridPos": {"h": 5, "w": 6, "x": 6, "y": 0},
"id": 2,
"options": {"reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
"targets": [{"expr": "sum(kube_pod_status_phase{namespace=\"microservices\",phase=\"Running\"})", "legendFormat": "running", "refId": "A"}],
"title": "Running Pods",
"type": "stat"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
"gridPos": {"h": 5, "w": 6, "x": 12, "y": 0},
"id": 3,
"options": {"reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
"targets": [{"expr": "sum(increase(kube_pod_container_status_restarts_total{namespace=\"microservices\"}[1h]))", "legendFormat": "restarts", "refId": "A"}],
"title": "Restarts / 1h",
"type": "stat"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
"gridPos": {"h": 5, "w": 6, "x": 18, "y": 0},
"id": 4,
"options": {"reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto"},
"targets": [{"expr": "sum(kube_pod_status_phase{namespace=\"microservices\",phase=~\"Pending|Failed|Unknown\"})", "legendFormat": "not running", "refId": "A"}],
"title": "Pods Needing Attention",
"type": "stat"
},
{
"datasource": {"type": "prometheus", "uid": "prometheus"},
"fieldConfig": {"defaults": {"unit": "none"}, "overrides": []},
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 5},
"id": 5,
"targets": [{"expr": "sum by (deployment) (kube_deployment_status_replicas_available{namespace=\"microservices\"})", "legendFormat": "{{deployment}}", "refId": "A"}],
"title": "Deployment Availability",
"type": "timeseries"
},
{
"datasource": {"type": "loki", "uid": "loki"},
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 5},
"id": 6,
"options": {"dedupStrategy": "none", "enableLogDetails": true, "prettifyLogMessage": false, "showCommonLabels": false, "showLabels": false, "showTime": true, "sortOrder": "Descending", "wrapLogMessage": true},
"targets": [{"expr": "{namespace=\"microservices\"}", "refId": "A"}],
"title": "Recent Logs",
"type": "logs"
}
],
"refresh": "30s",
"schemaVersion": 39,
"tags": ["microservices", "apps"],
"templating": {"list": []},
"time": {"from": "now-1h", "to": "now"},
"timezone": "browser",
"title": "Apps / MicroServices Overview",
"uid": "apps-microservices-overview",
"version": 1
}
@@ -9,7 +9,14 @@ data:
datasources.yaml: |
apiVersion: 1
datasources:
- name: Prometheus
uid: prometheus
type: prometheus
access: proxy
url: "http://kube-prometheus-stack-prometheus.observability.svc.cluster.local:9090"
isDefault: true
- name: Loki
uid: loki
type: loki
access: proxy
url: "http://loki.observability.svc.cluster.local:3100"
@@ -2,4 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- grafana-datasources-core-configmap.yaml
- grafana-dashboard-k8s-overview-configmap.yaml
- grafana-dashboard-cluster-overview-configmap.yaml
- grafana-dashboard-flux-gitops-configmap.yaml
- grafana-dashboard-microservices-overview-configmap.yaml
@@ -25,6 +25,7 @@ spec:
values:
grafana:
enabled: true
defaultDashboardsEnabled: false
admin:
existingSecret: grafana-admin-credentials
grafana.ini:
@@ -53,6 +54,21 @@ spec:
externalUrl: http://prometheus.silverside-gopher.ts.net:9090/
routePrefix: /
retention: 7d
ruleSelectorNilUsesHelmValues: false
ruleSelector: {}
ruleNamespaceSelector: {}
serviceMonitorSelectorNilUsesHelmValues: false
serviceMonitorSelector: {}
serviceMonitorNamespaceSelector: {}
podMonitorSelectorNilUsesHelmValues: false
podMonitorSelector: {}
podMonitorNamespaceSelector: {}
probeSelectorNilUsesHelmValues: false
probeSelector: {}
probeNamespaceSelector: {}
scrapeConfigSelectorNilUsesHelmValues: false
scrapeConfigSelector: {}
scrapeConfigNamespaceSelector: {}
storageSpec:
volumeClaimTemplate:
spec: