Volume
Last updated
Last updated
In Pi, volume is a persistent storage service to use with Pod. It offers high availability, durability, and consistent performance needed for stateful workloads. Multiple replicas will be automatically created with each volume to protect your data from failure.
Volumes are constrained by availability zone. You may switch volumes between pods in the same availability zone, but there is currently no way for pod to access volumes residing in different zones. Volume name is region-wise unique, e.g. no two volumes in the same region can have the same volume name. Once a volume is attached to a pod, it will be associated with the pod throughout the pod's lifecycle, which means that:
Volumes cannot be deleted or detached when it is attached to a pod.
Volumes cannot be shared. There is no way tp attache a volume to multiple pods simultaneously.
Volumes will be automatically detached, when the associated pod terminated.
Volume use the EXT4
filesystem. A volume size must be integer, and between 1 and 50 (GB).
The max volume number a single pod can support is 4, though one volume can be mounted by all containers in the pod (with different mountpoints). In this case, the volume is shared by all containers in that pod, however volume cannot be shared by multiple pods.
Unlike Rootfs, volumes are independent from pods. You need to explicitly create and delete volumes:
To mount volumes to a container:
To verify the mount:
You can also mount the same volume to different mountpoints of the different containers.
Verify
Notes on reusing existing volumes: users should pay attention to volume access permissions. For example, if a volume is first mounted in pod foo
and then reused in pod bar
, the file/directory permissions in the volume will remain the same those set in pod foo
. As a result, a change of container users (uid/gid pair) may effect the volume's access rights.