Skip to main content
Fly Kubernetes is in closed beta and not recommended for critical production usage. To report issues or provide feedback, email us at beta@fly.io.
Fly Kubernetes supports persistent volumes and generic ephemeral volumes. There are general considerations to keep in mind when using volumes in Fly Kubernetes:
  • 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:
In our configuration:
  • The storageClassName must be set to either flyio-volume or flyio-volume-retain. You can view the available storage classes with kubectl get sc. The default StorageClass is flyio-volume.
  • selector is 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.
  • accessModes only supports ReadWriteOncePod.
After applying the configuration, you can view the PVC and PV generated by the definition using kubectl.

Reclaim policy

Fly Kubernetes supports both the Delete and Retain policy for PersistentVolumes.
  • StorageClass flyio-volume has a reclaim policy set to Delete
  • StorageClass flyio-volume-retain has a reclaim policy set to Retain
By default, 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
The annotation 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:
For generic ephemeral volumes to work as expected, storageClassName must be set to flyio-volume.