Funk-lab/k8s/infra/monitoring/alerts/alerts-k8s.yaml
alkatrazz 18da44a89f feat: monitoring — dashboards Grafana + alertes Prometheus
Dashboards (ConfigMaps, auto-importés par sidecar Grafana) :
- dashboard-kubernetes : cluster overview, pods, PVCs, restarts
- dashboard-infrastructure : compute/storage-01/gpu-01 CPU/RAM/disque/réseau + GPU ROCm
- dashboard-ai : llama-server GPU/CPU tokens/s, requêtes, VRAM, température GPU

Alertes (PrometheusRule) :
- alerts-node : CPU>90%, RAM>90%, disque>80%, storage-01/gpu-01 down, load élevé
- alerts-k8s : NodeNotReady, PodCrashLoop, PodPending, DeploymentUnavailable, PVCNotBound, ArgoCDOutOfSync
- alerts-ai : llama-server GPU/system/monitor down, GPU temp>80°C, VRAM>95%, queue élevée

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 22:47:49 +02:00

88 lines
3.1 KiB
YAML

apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: funk-k8s-alerts
namespace: monitoring
labels:
release: kube-prometheus-stack
spec:
groups:
- name: funk.kubernetes
interval: 1m
rules:
# --- Nœuds ---
- alert: KubeNodeNotReady
expr: |
kube_node_status_condition{condition="Ready",status="true"} == 0
for: 5m
labels:
severity: critical
annotations:
summary: "Nœud k8s NotReady : {{ $labels.node }}"
description: "Le nœud {{ $labels.node }} est NotReady depuis 5 min. Les workloads peuvent être impactés."
# --- Pods ---
- alert: PodCrashLooping
expr: |
increase(kube_pod_container_status_restarts_total[15m]) > 3
for: 5m
labels:
severity: warning
annotations:
summary: "Pod en CrashLoop : {{ $labels.namespace }}/{{ $labels.pod }}"
description: "{{ $labels.container }} a redémarré {{ $value | printf \"%.0f\" }} fois en 15 min."
- alert: PodFailedLong
expr: |
kube_pod_status_phase{phase=~"Failed|Unknown"} == 1
for: 10m
labels:
severity: warning
annotations:
summary: "Pod en échec : {{ $labels.namespace }}/{{ $labels.pod }}"
description: "Le pod est en phase {{ $labels.phase }} depuis 10 min."
- alert: PodPendingLong
expr: |
kube_pod_status_phase{phase="Pending"} == 1
for: 15m
labels:
severity: warning
annotations:
summary: "Pod Pending depuis 15 min : {{ $labels.namespace }}/{{ $labels.pod }}"
description: "Vérifier les ressources disponibles, PVCs, et les événements du pod."
# --- Deployments ---
- alert: DeploymentUnavailable
expr: |
kube_deployment_status_replicas_available
< kube_deployment_spec_replicas
for: 5m
labels:
severity: warning
annotations:
summary: "Deployment dégradé : {{ $labels.namespace }}/{{ $labels.deployment }}"
description: "{{ $labels.deployment }} : {{ $value }} réplicas disponibles sur {{ $labels.replicas }} attendus."
# --- Stockage ---
- alert: PVCNotBound
expr: |
kube_persistentvolumeclaim_status_phase{phase!="Bound"} == 1
for: 10m
labels:
severity: warning
annotations:
summary: "PVC non lié : {{ $labels.namespace }}/{{ $labels.persistentvolumeclaim }}"
description: "La PVC est en phase {{ $labels.phase }} depuis 10 min. Vérifier le NFS provisioner."
# --- ArgoCD ---
- alert: ArgoCDAppOutOfSync
expr: |
count(argocd_app_info{sync_status!="Synced"}) > 0
for: 30m
labels:
severity: warning
annotations:
summary: "Application(s) ArgoCD OutOfSync depuis 30 min"
description: "{{ $value }} app(s) ne sont pas synchronisées. Vérifier http://argocd.lab.local"