Volumes
Every cluster ships a default StorageClass, kubrain. Declare a standard
PersistentVolumeClaim and a real volume is created and attached when a pod first
uses it (WaitForFirstConsumer); data survives pod restarts and reschedules.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: kubrain
resources:
requests:
storage: 20GiDesign around ReadWriteOnce
The kubrain class is RWO — a volume attaches to one node at a time. Shape
your workload accordingly:
- Single-instance stateful (a database):
replicas: 1, one PVC, anddeployment.strategy: Recreateinkubrain.yamlso the volume detaches cleanly before the new pod attaches. - Multi-replica stateful: use a StatefulSet via a
kubrain/k8s-templates/statefulset.yamloverride withvolumeClaimTemplates(one volume per replica).
Cost
Volumes bill at €0.05 / GiB-month, with the first 20 GiB free per tenant. Deleting the PVC frees the volume and stops the charge.