# ExpertFab – Longhorn Storage Architektur

**Speicherfluss & HA-Analyse:** [../diagrams/storage_flow.png](../diagrams/storage_flow.png)  
*(Quelle: [../diagrams/storage_flow.dot](../diagrams/storage_flow.dot))*

**Übersicht (alt):** [../diagrams/storage_architecture.png](../diagrams/storage_architecture.png)

---

## StorageClasses

| Name                | Reclaim | Binding   | Verwendung               |
|---------------------|---------|-----------|--------------------------|
| `longhorn`          | Delete  | Immediate | RabbitMQ, Zitadel        |
| `longhorn-erpnext`  | Retain  | Immediate | ERPNext (Daten bleiben!) |
| `longhorn-paperless`| Retain  | Immediate | Paperless (Daten bleiben!)|
| `longhorn-static`   | Delete  | Immediate | Manuell provisionierte Volumes |
| `local-path`        | Delete  | WaitForFirstConsumer | Rancher local-path |

> **Retain** = PV bleibt erhalten wenn PVC gelöscht wird → Schutz vor Datenverlust

---

## PVCs nach Namespace

### namespace: erpnext
| PVC                        | Größe | Mode | StorageClass        |
|----------------------------|-------|------|---------------------|
| data-erpnext-mariadb-sts-0 | 3 Gi  | RWO  | longhorn-erpnext    |
| erpnext                    | 3 Gi  | RWX  | longhorn-erpnext    |
| erpnext-logs               | 1 Gi  | RWX  | longhorn-erpnext    |

### namespace: paperless
| PVC                | Größe | Mode | StorageClass         |
|--------------------|-------|------|----------------------|
| paperless-media    | 10 Gi | RWO  | longhorn-paperless   |
| paperless-consume  | 5 Gi  | RWO  | longhorn-paperless   |
| paperless-data     | 5 Gi  | RWO  | longhorn-paperless   |
| postgres-data      | 5 Gi  | RWO  | longhorn-paperless   |

### namespace: rabbitmq
| PVC                      | Größe | Mode | StorageClass |
|--------------------------|-------|------|--------------|
| rabbitmq-data-rabbitmq-0 | 5 Gi  | RWO  | longhorn     |

### namespace: zitadel
| PVC                     | Größe | Mode | StorageClass |
|-------------------------|-------|------|--------------|
| postgres-data-postgres-0| 10 Gi | RWO  | longhorn     |

---

## Longhorn Pods nach Node

### efsckubnode1 (10.42.71.51)
| Pod                       | Typ        | Replicas |
|---------------------------|------------|----------|
| longhorn-manager          | DaemonSet  | 1        |
| longhorn-csi-plugin       | DaemonSet  | 1        |
| engine-image              | DaemonSet  | 1        |
| instance-manager          | –          | 1        |
| longhorn-driver-deployer  | Deployment | 1        |
| longhorn-ui               | Deployment | 2        |
| csi-attacher              | Deployment | 3        |
| csi-provisioner           | Deployment | 3        |
| csi-resizer               | Deployment | 3        |
| csi-snapshotter           | Deployment | 3        |

### efsckubnode2 (10.42.71.52)
| Pod                         | Typ       | Beschreibung                        |
|-----------------------------|-----------|-------------------------------------|
| longhorn-manager            | DaemonSet | –                                   |
| longhorn-csi-plugin         | DaemonSet | –                                   |
| engine-image                | DaemonSet | –                                   |
| instance-manager            | –         | –                                   |
| share-manager (erpnext)     | –         | Bedient RWX-Volume `erpnext` (3Gi)  |
| share-manager (erpnext-logs)| –         | Bedient RWX-Volume `erpnext-logs` (1Gi) |
| daily-backup                | CronJob   | Tägliches Backup                    |

> **share-manager** Pods werden für RWX-Volumes benötigt: Longhorn stellt RWX über NFS-Share-Manager bereit.  
> CSI-Controller-Pods (attacher, provisioner, resizer, snapshotter) laufen nur auf `efsckubnode1`.

---

## Hinweise

- Longhorn UI: erreichbar über Port-Forward `kubectl port-forward -n longhorn-system svc/longhorn-frontend 8080:80`
- Replikation: Standard 2 Replicas (beide Worker-Nodes)
- Backups: `daily-backup` CronJob auf efsckubnode2
