Runbook: PVCAlmostFull / PVCFull¶
Alertes :
- PVCAlmostFull (severity warning) — > 85% utilisé
- PVCFull (severity critical) — > 95% utilisé, writes vont échouer
Diagnostic¶
1. Identifier la PVC et son usage¶
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
# Liste toutes les PVC avec leur usage
kubectl get pvc -n akko -o custom-columns=NAME:.metadata.name,SIZE:.spec.resources.requests.storage,SC:.spec.storageClassName
# Usage réel via Prometheus
kubectl exec -n akko akko-monitoring-prometheus-0 -c prometheus -- \
wget -qO- 'http://localhost:9090/api/v1/query?query=kubelet_volume_stats_used_bytes+/+kubelet_volume_stats_capacity_bytes' \
| jq '.data.result[] | {pvc: .metric.persistentvolumeclaim, usage: .value[1]}'
2. Identifier ce qui prend la place¶
# Shell dans le pod qui utilise la PVC
kubectl exec -n akko -it <pod> -- sh
# Dans le pod
du -sh /path/to/pvc-mount/* | sort -hr | head -10
Remediation¶
Option A : Resize (si storageClass supporte)¶
local-path (Netcup default) : ne supporte PAS le resize online.
longhorn / EBS / PD / AzureDisk : resize online possible :
Option B : Cleanup manuel (pour local-path)¶
Par service :
| Service | Cleanup command |
|---|---|
| Postgres logs/WAL | kubectl exec -n akko akko-postgresql-0 -- psql -U postgres -c "SELECT pg_switch_wal();" |
| Prometheus TSDB | Bump retention dans values (ex: 15d → 7d) + helm upgrade |
| logs layer chunks | Bump retention dans values loki + helm upgrade |
| S3 bucket | mc rm -r --force akko/akko-warehouse/<old-date>/ |
| Airflow logs | Logs via emptyDir depuis Sprint 12 (non-issue) |
Option C : Migration vers storageClass resizable (prod-ready)¶
# 1. Install Longhorn (prérequis: disque dédié)
bash helm/scripts/install-longhorn.sh
# 2. Migrer la PVC (script à écrire dans Sprint 2)
# Pour l'instant: backup → delete PVC → recreate avec longhorn → restore
bash helm/scripts/demo/banking/seed.sh --restore
Fix pérenne (règle R02)¶
- Si cleanup récurrent requis → implémenter un CronJob cleanup dans
helm/akko/charts/akko-init/templates/ - Si une PVC est systématiquement petite → bump la valeur dans
helm/examples/values-netcup.yaml(après migration storageClass) - Si une feature fuit → identifier et fix dans le code du service
Jamais de kubectl edit direct sans commit.
Prévention¶
- PrometheusRule
PVCAlmostFullalerte à 85% (déjà en place) - Dashboard Dashboards "PVC Usage" (à créer Sprint 22.1.4)
- Backup CronJob vers S3 bucket
akko-backups(déjà en place)
Lessons learned¶
L09 (cf. _RULES.md) : local-path non-resizable → aligner les values
sur le live ou migrer vers Longhorn. Bug récurrent Sprint 14.