# Use persistent volumes

Store data on {{product}} volumes through PersistentVolumeClaims, encrypted on the node by default.

A PersistentVolumeClaim gets a Deutsche Cloud volume, which bills as a volume. Every cluster has two
StorageClasses:

| StorageClass                     | What it is                                                                                    |
| -------------------------------- | --------------------------------------------------------------------------------------------- |
| `ews-volume-encrypted` (default) | Opened with LUKS on the node; the key is released only to the node the volume is attached to. |
| `ews-volume`                     | Not encrypted by Deutsche Cloud.                                                                 |

Both are ReadWriteOnce, bound when a pod is scheduled (`WaitForFirstConsumer`), expandable, and
deleted with their claim (`reclaimPolicy: Delete`).

## Prerequisites

- kubectl access to the cluster: `eks:AccessKubernetesApi` in IAM and an access entry whose policy
  lets you create PersistentVolumeClaims in the namespace (`Edit` or more; see
  [Connect with kubectl](connect-with-kubectl.md)).

## Create a claim

```yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: data
spec:
  accessModes: [ReadWriteOnce]
  resources:
    requests:
      storage: 20Gi
```

Apply it with `kubectl apply -f data.yaml`. The volume is created when the first pod that uses the
claim is scheduled, in that node's zone; pods using it are scheduled in that zone afterwards.

To grow it, raise `storage` in the claim while it is in use.

## Limits

- 10 to 10240 GiB per volume, in whole GiB. A smaller request gets 10 GiB; a larger one is refused.
- At most 16 volumes attached to one node.
- No ReadWriteMany and no volume snapshots. Back data up with a tool that copies files, for
  example Velero file-system backup to an S3 bucket.
- A cluster's etcd snapshots do not contain volume data.

The cluster's volumes are listed on its **Networking** tab, with `ec2:DescribeVolumes`.

## Related

- [Clusters and node groups](clusters-and-node-groups.md)
- [Expose a Service](expose-a-service.md)
