- Volumes are built on top of Fly Volumes. They are local NVME drives and require your Pod to be deployed in the same region as the volume.
- Only one persistent or ephemeral volume can be mounted at a time.
- The maximum storage size available is 500GB.
Persistent Volumes
PersistentVolumes are managed through PersistentVolumeClaims (PVCs). PersistentVolumes (PVs) are tied to the lifecycle of a PersistentVolumeClaim. By default, creating a PVC creates an underlying PV and deleting a PVC deletes the PV bound to it. Below is an example of configuring a PersistentVolume to use with a Pod:- The
storageClassNamemust be set to eitherflyio-volumeorflyio-volume-retain. You can view the available storage classes withkubectl get sc. The default StorageClass isflyio-volume. selectoris optional. It serves a dual purpose. First, it ensures that a PVC is bound to a PV in the region specified in the selector. Second, if a PVC requires dynamic provisioning of the underlying Fly Volume, it is provisioned in the specified region. If not set, the volume is created in the region of the cluster.accessModesonly supportsReadWriteOncePod.
kubectl.
Reclaim policy
Fly Kubernetes supports both theDelete and Retain policy for PersistentVolumes.
- StorageClass
flyio-volumehas a reclaim policy set toDelete - StorageClass
flyio-volume-retainhas a reclaim policy set toRetain
flyio-volume is used.
When using the flyio-volume-retain StorageClass, you are responsible for deleting the PersistentVolume object and its underlying Fly Volume.
The details of the underlying storage are found in the annotations of the PersistentVolume. Using the PV from above
fly.io/app specifies which Fly app the volumes belongs to. The annotation volume.fly.io/id gives you the ID of the volume.
You can delete the Fly Volume using flyctl
Generic ephemeral volumes
Fly Kubernetes supports ephemeral volumes through generic ephemeral volumes. It uses the same underlying PVC and PV machinery. Kubernetes handles creating the PVC and its corresponding PV and deleting both objects when the Pod is deleted. Below is an example of creating a Pod with a generic ephemeral volume:storageClassName must be set to flyio-volume.