68 lines
1.6 KiB
Markdown
68 lines
1.6 KiB
Markdown
# 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
|
|
```yaml
|
|
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
|
|
```yaml
|
|
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]]
|