monitoring: kube-prometheus-stack + WireGuard-only Grafana via the internal gateway
- clusters/homek8s/monitoring.yaml: the 'monitoring' Flux Kustomization was declared only under clusters/home, which the bootstrapped flux-system Kustomization never reads (its path is ./clusters/homek8s), so it had never been created. Declare it in the tree that actually reconciles. - monitoring/controllers/home: HelmRepository + HelmRelease (chart pinned 92.14.0), values.yaml via configMapGenerator, Grafana admin from the monitoring/grafana-admin Secret (out of band, never in git). - Everything pinned to siriussec, Prometheus on a 10Gi local-path PVC with 7d AND 8GB retention caps; alertmanager off; no remote write. - internal gateway listener now accepts routes from any namespace; the security boundary is the host firewall, not the namespace. - host-firewall/: nft table + oneshot unit for siriussec and the ufw script for rpi that close :8081 to everything but 10.10.0.0/24 and 10.244.0.0/16.
This commit is contained in:
parent
242d76a6d3
commit
d3741df619
13 changed files with 367 additions and 2 deletions
28
monitoring/controllers/home/httproute.yaml
Normal file
28
monitoring/controllers/home/httproute.yaml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# Grafana is served by the INTERNAL gateway only (gateway-system is the public
|
||||
# one, fed by the Cloudflare tunnel). There is no Cloudflare ingress entry for
|
||||
# this hostname and there must never be one.
|
||||
#
|
||||
# Reachable at http://grafana.lab.internal:8081 over WireGuard:
|
||||
# Legion /etc/hosts: 10.10.0.2 grafana.lab.internal
|
||||
# The listener answers only on 10.10.0.0/24 + the pod CIDR — the host firewall
|
||||
# (see docs/internal-wireguard-services.md) drops :8081 everywhere else.
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: grafana
|
||||
namespace: monitoring
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: internal
|
||||
namespace: internal
|
||||
sectionName: http-internal
|
||||
hostnames:
|
||||
- grafana.lab.internal
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /
|
||||
backendRefs:
|
||||
- name: kube-prometheus-stack-grafana
|
||||
port: 80
|
||||
|
|
@ -1,3 +1,14 @@
|
|||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources: []
|
||||
namespace: monitoring
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- repository.yaml
|
||||
- release.yaml
|
||||
- httproute.yaml
|
||||
configMapGenerator:
|
||||
- name: kube-prometheus-stack-values
|
||||
files:
|
||||
- values.yaml=values.yaml
|
||||
configurations:
|
||||
- kustomizeconfig.yaml
|
||||
|
|
|
|||
6
monitoring/controllers/home/kustomizeconfig.yaml
Normal file
6
monitoring/controllers/home/kustomizeconfig.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
nameReference:
|
||||
- kind: ConfigMap
|
||||
version: v1
|
||||
fieldSpecs:
|
||||
- path: spec/valuesFrom/name
|
||||
kind: HelmRelease
|
||||
4
monitoring/controllers/home/namespace.yaml
Normal file
4
monitoring/controllers/home/namespace.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: monitoring
|
||||
34
monitoring/controllers/home/release.yaml
Normal file
34
monitoring/controllers/home/release.yaml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||
kind: HelmRelease
|
||||
metadata:
|
||||
name: kube-prometheus-stack
|
||||
namespace: monitoring
|
||||
spec:
|
||||
releaseName: kube-prometheus-stack
|
||||
interval: 30m
|
||||
chart:
|
||||
spec:
|
||||
chart: kube-prometheus-stack
|
||||
# Pinned — never a floating range. Bump deliberately.
|
||||
version: "92.14.0"
|
||||
sourceRef:
|
||||
kind: HelmRepository
|
||||
name: prometheus-community
|
||||
namespace: monitoring
|
||||
install:
|
||||
crds: Create
|
||||
timeout: 15m
|
||||
remediation:
|
||||
retries: 3
|
||||
upgrade:
|
||||
crds: CreateReplace
|
||||
timeout: 15m
|
||||
cleanupOnFail: true
|
||||
remediation:
|
||||
retries: 3
|
||||
remediateLastFailure: true
|
||||
# Values live in monitoring/controllers/home/values.yaml, rendered to a
|
||||
# Flux ConfigMap (kube-prometheus-stack-values-<hash>) by kustomize.
|
||||
valuesFrom:
|
||||
- kind: ConfigMap
|
||||
name: kube-prometheus-stack-values
|
||||
8
monitoring/controllers/home/repository.yaml
Normal file
8
monitoring/controllers/home/repository.yaml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: HelmRepository
|
||||
metadata:
|
||||
name: prometheus-community
|
||||
namespace: monitoring
|
||||
spec:
|
||||
interval: 24h
|
||||
url: https://prometheus-community.github.io/helm-charts
|
||||
140
monitoring/controllers/home/values.yaml
Normal file
140
monitoring/controllers/home/values.yaml
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
# kube-prometheus-stack values — home cluster (Sirius DevOps)
|
||||
#
|
||||
# Pinned in release.yaml to chart 92.14.0 (appVersion v0.94.2).
|
||||
# Everything lands on siriussec: amd64 image (rpi is arm64) + local-path PVs.
|
||||
# Prometheus is capped twice (time AND bytes) so a metrics burst can never
|
||||
# repeat the ephemeral-storage / DiskPressure incident (see docs/cluster-overview.md).
|
||||
|
||||
# --- Alertmanager: off. No receivers in this card; alerts fire to nowhere on purpose.
|
||||
alertmanager:
|
||||
enabled: false
|
||||
|
||||
defaultRules:
|
||||
create: true
|
||||
# Control-plane / proxy components that this cluster does not expose to
|
||||
# Prometheus: kube-proxy is replaced by Cilium, and the kubeadm static pods
|
||||
# only bind their metrics on 127.0.0.1. Rules for them would sit "firing"
|
||||
# forever, so drop the whole groups that depend on those targets.
|
||||
rules:
|
||||
kubeProxy: false
|
||||
kubeControllerManager: false
|
||||
kubeScheduler: false
|
||||
kubeEtcd: false
|
||||
|
||||
# --- Control-plane targets that are unreachable or lift-heavy for a lab box
|
||||
kubeProxy:
|
||||
enabled: false
|
||||
kubeControllerManager:
|
||||
enabled: false
|
||||
kubeScheduler:
|
||||
enabled: false
|
||||
kubeEtcd:
|
||||
enabled: false
|
||||
kubeApiServer:
|
||||
enabled: true
|
||||
|
||||
prometheusOperator:
|
||||
nodeSelector:
|
||||
kubernetes.io/hostname: siriussec
|
||||
resources:
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 256Mi
|
||||
admissionWebhooks:
|
||||
patch:
|
||||
nodeSelector:
|
||||
kubernetes.io/hostname: siriussec
|
||||
|
||||
prometheus:
|
||||
enabled: true
|
||||
prometheusSpec:
|
||||
# Storage: local-path on siriussec. 10Gi PVC + an 8GB TSDB cap leaves
|
||||
# headroom for WAL/checkpoint files inside the same volume.
|
||||
retention: 7d
|
||||
retentionSize: 8GB
|
||||
scrapeInterval: 30s
|
||||
evaluationInterval: 30s
|
||||
nodeSelector:
|
||||
kubernetes.io/hostname: siriussec
|
||||
resources:
|
||||
requests:
|
||||
cpu: 200m
|
||||
memory: 512Mi
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: 2Gi
|
||||
storageSpec:
|
||||
volumeClaimTemplate:
|
||||
spec:
|
||||
storageClassName: local-path
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
# No remoteWrite / remoteRead / receivers: metrics never leave the cluster.
|
||||
|
||||
grafana:
|
||||
enabled: true
|
||||
nodeSelector:
|
||||
kubernetes.io/hostname: siriussec
|
||||
# Admin credentials live in the monitoring/grafana-admin Secret (created out of
|
||||
# band with kubectl, never in git). Keys: admin-user, admin-password.
|
||||
admin:
|
||||
existingSecret: grafana-admin
|
||||
resources:
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
# Dashboards and datasources are provisioned from ConfigMaps (chart-generated,
|
||||
# sidecar-loaded) — nothing is created by hand in the UI.
|
||||
defaultDashboardsEnabled: true
|
||||
sidecar:
|
||||
dashboards:
|
||||
enabled: true
|
||||
label: grafana_dashboard
|
||||
datasources:
|
||||
enabled: true
|
||||
label: grafana_datasource
|
||||
# No persistence: Grafana state is provisioned from git, and a PVC here would
|
||||
# only compete for the same disk that Prometheus needs.
|
||||
persistence:
|
||||
enabled: false
|
||||
grafana.ini:
|
||||
auth.anonymous:
|
||||
enabled: false
|
||||
users:
|
||||
allow_sign_up: false
|
||||
analytics:
|
||||
reporting_enabled: false
|
||||
|
||||
kube-state-metrics:
|
||||
nodeSelector:
|
||||
kubernetes.io/hostname: siriussec
|
||||
resources:
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 32Mi
|
||||
limits:
|
||||
cpu: 200m
|
||||
memory: 256Mi
|
||||
|
||||
prometheus-node-exporter:
|
||||
# DaemonSet; pinned to siriussec per the stack's scheduling rule. Only
|
||||
# siriussec's node metrics are collected (kubelet/cAdvisor metrics for the
|
||||
# other nodes still arrive via the kubelet ServiceMonitor).
|
||||
nodeSelector:
|
||||
kubernetes.io/hostname: siriussec
|
||||
resources:
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 32Mi
|
||||
limits:
|
||||
cpu: 200m
|
||||
memory: 128Mi
|
||||
Loading…
Reference in a new issue