Files in a container are ephemeral. When the container is terminated, the files are gone. Docker has introduced data volumes to help us persist data (https://docs.docker.com/engine/admin/volumes/volumes). However, when it comes to multiple hosts, as a container cluster, it is hard to manage volumes across all the containers and hosts for file sharing or provisioning volume dynamically. Kubernetes introduces volume, which lives with a Pod across a container life cycle. It supports various types of volumes, including popular network disk solutions and storage services in different public clouds. Here are a few:
Volume type |
Storage provider |
emptyDir |
Localhost |
hostPath |
Localhost |
glusterfs |
GlusterFS cluster |
downwardAPI |
Kubernetes Pod information |
nfs |
NFS server |
awsElasticBlockStore |
Amazon Web Service Amazon Elastic Block... |