Persistent storage
We advise against using persistent volumes (PV). It is often better to use a separate database or S3 storage for persisting state. See Related services for our database and S3 offerings. If you do have a use case for PVs, this page shows how to use them.
Limitations
- Only access mode
ReadWriteOnce(RWO) is supported. There is currently no support forReadWriteMany(RWX), so a volume can only be mounted read-write by a single node at a time. - All pods that need to read/write the same volume therefore have to run on the same node. This is not a problem for e.g. StatefulSets, but keep it in mind when designing a deployment that uses PVs.
- Have a backup plan for your persistent data, see Before you start.
Example
No special permissions are needed to use this functionality.
Create a claim:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: claim1
namespace: <your namespace>
spec:
accessModes:
- ReadWriteOnce
storageClassName: rlcs-ssd
resources:
requests:
storage: 1Gi
Then point to the claim in your deployment:
Remember to also add a volumeMounts entry to the container that should use the volume.