Files
obsidian-sympozium/08-Słownik-K8s/PersistentVolumeClaim.md
2026-03-25 00:05:57 +01:00

1.6 KiB

PersistentVolumeClaim (PVC)

#kubernetes #storage #słownik

Co to jest?

PersistentVolumeClaim (PVC) to żądanie trwałego storage w Kubernetes. PVC abstrakcje underlying storage (dysk, NFS, cloud volume) i zapewnia dane przetrwają restart poda.

Jak działa?

PVC (żądanie: 10Gi, ReadWriteOnce)
    ↓
StorageClass (provisioner: ebs/gce-pd/local)
    ↓
PersistentVolume (faktyczny dysk)
    ↓
Pod mountuje PVC

Access Modes

Mode Opis Skrót
ReadWriteOnce Jeden node może czytać/pisać RWO
ReadOnlyMany Wiele node'ów read-only ROX
ReadWriteMany Wiele node'ów read/write RWX

emptyDir vs PVC

emptyDir PVC
Lifecycle Z podem Niezależny od poda
Persistence NIE - dane znikają TAK - dane trwają
Sharing Między kontenerami w podzie Między podami (z ograniczeniami)
Speed Szybki (RAM option) Zależne od storage

Użycie w Sympozium

Memory PVC

name: <instance>-memory-db
spec:
  accessModes: [ReadWriteOnce]
  resources:
    requests:
      storage: 1Gi

Przechowuje SQLite DB z pamięcią agenta. Przetrwa restarty memory-server poda.

WhatsApp PVC

name: <instance>-channel-whatsapp-data
spec:
  accessModes: [ReadWriteOnce]
  resources:
    requests:
      storage: 256Mi

Przechowuje WhatsApp credentials (QR link survives restarts).

Strategy: Recreate

Oba PVC są RWO (jeden pod na raz), więc Deployment Strategy musi być Recreate (nie RollingUpdate).


Powiązane: Persistent Memory | ConfigMap i Secret | Kanały - Telegram Slack Discord WhatsApp