---
title: "Storage"
description: "PersistentVolumeClaims backed by Block Storage volumes and Files access points."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Storage

A cluster turns PersistentVolumeClaims into EZGH storage in your project, made as its cluster bot:

| | Block Storage | Files |
| --- | --- | --- |
| Add-on | `blockstore-csi` (installed) | `files-csi` (optional) |
| StorageClass | `ezgh-gp1` (the default) | Your own, naming your file system |
| Access mode | `ReadWriteOnce` | `ReadWriteMany` |
| Each volume is | A [volume](/compute/volumes) | An [access point](/files/access-points) on your file system |

## Block Storage volumes

`ezgh-gp1` is the default StorageClass. Its volumes are created when the first pod using the claim is
scheduled (`WaitForFirstConsumer`), and deleted with the claim (`reclaimPolicy: Delete`). A volume
follows its pod to another node: it's detached and attached while the cluster runs.

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

- Volumes are formatted ext4. For xfs, create a StorageClass of your own:

  ```yaml
  apiVersion: storage.k8s.io/v1
  kind: StorageClass
  metadata:
    name: gp1-xfs
  provisioner: blockstore.csi.ezghcloud.com
  parameters:
    type: gp1
    csi.storage.k8s.io/fstype: xfs
  reclaimPolicy: Delete
  volumeBindingMode: WaitForFirstConsumer
  allowVolumeExpansion: true
  ```
- Claims can be expanded: raise `spec.resources.requests.storage`.
- A `VolumeSnapshot` (the default VolumeSnapshotClass is `ezgh-gp1`) is a Block Storage
  [snapshot](/compute/snapshots), and a claim can be restored from one. Claims can't be cloned from another claim: take a snapshot and restore it.
- Every volume is encrypted at rest, as every Block Storage volume is.
- A node holds as many PersistentVolumes as its [instance type](/compute/instance-types)'s `limits.volumes`,
  less one for the root volume.

## Files volumes

Files volumes can be mounted by many pods on many nodes at once. Create a [file system](/files) and a
[mount target](/files/mount) in the node group's subnet, and add the node subnet's range to the mount
target's `allowedSourceCidrs`: mounts are allowed by network address.

Then add the `files-csi` add-on:

```sh
ezgh kubernetes addons create files-csi --cluster kcl_3k9d0a1m2x7q --wait
```

It installs the StorageClass `ezgh-files`, which names no file system. Create a StorageClass of your
own with `fileSystem` set to yours:

```yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: shared
provisioner: files.csi.ezghcloud.com
parameters:
  fileSystem: fsy_4n8b2v6c1x3z
  tls: "true"
reclaimPolicy: Delete
volumeBindingMode: Immediate
```

```yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: shared
spec:
  accessModes: [ReadWriteMany]
  storageClassName: shared
  resources:
    requests:
      storage: 100Gi
```

| Parameter | |
| --- | --- |
| `fileSystem` | The file system (`fsy_…`). Required |
| `tls` | `"true"` mounts with [TLS](/files/tls). Default `"false"` |
| `uid`, `gid` | The owner of each claim's directory, and the user and group its files are written as. Default `1000` |
| `directoryPerms` | The mode each claim's directory is created with. Default `0770` |

- Each claim gets its own [access point](/files/access-points), exporting the directory
  `/kubernetes/<PersistentVolume name>` of the file system. Deleting the claim deletes the access point
  but keeps its files on the file system.
- Each claim counts against the file system's access points [quota](/quotas).
- A file system's size isn't fixed, so a claim's requested size isn't a limit. Claims can't be
  expanded, cloned or restored from a snapshot.
- A static PersistentVolume of driver `files.csi.ezghcloud.com` mounts files that already exist: its
  `volumeHandle` is a file system (`fsy_…`), a directory of one (`fsy_…:/path`) or an access point
  (`fap_…`).

## When a cluster is deleted

Volumes a cluster created for claims are kept when the cluster is deleted, tagged with the cluster.
Delete the claims first to delete their volumes with them.

Source: https://docs.ezghcloud.com/kubernetes/storage/index.mdx
