Use Persistent Volumes
Volume Definition
You only need to define 3 things for a volume:
- Its name, so it can be mounted into a Component
- Its size
- Its type (more on this in a bit)
Â
Pre-requisites
Note
Using Persistent Volumes requires an initial setup for the Kubernetes cluster.
More information on this subject is available in our Volumes documentation.
Â
Types of volumes
Single-node attachment (Disk)
These volumes can be attached to just one node, so if you're planning to use multiple replicas for a Service, or to use the same volume in multiple Services, consider using the multi-node attachment.
In Bunnyshell, we called this type Disk.
The benefit of using single-node attachment volumes is their performance advantage over multi-node attachment volumes, which rely on the network to transfer data.
Multi-node attachment (Network)
When in need of a single storage for multiple Services (or replicas of the Same service) to write into, the Network disk type should be used in Bunnyshell.
Behind the scenes, it creates an NFS storage.
Note
Using disk for multiple Services (or replicas of the same Service) is not guaranteed to work, which is why it's not recommended. The Kubernetes Scheduler will probably not schedule Pods based on that condition.
Â
Detecting & Converting volumes
Volumes are automatically detected from your docker-compose.yaml
file and the best-performance type is chosen, based on the volume's usage (mount in Services).
Note
Please check the Volumes documentation for more information.
Â
Discarded Docker-compose (local) volumes
Folders mounted locally in Docker-compose will not have any use when deployed in Kubernetes (or anywhere else other than a local environment). That is why they are discarded.
At the same time, volumes which are not used in any Component are discarded.
Updated about 1 year ago