Kubernetes 101 : Volumes and persistent storage

Containers have their own isolated filesystem. The data stored in the container's filesystem is lost once the container exits or crashes.

When we re-deploy a new copy of a container, the new copy gets deployed with a new filesystem.

Kubernetes volumes:

Volumes are a storage that is independent of the lifecycle of the container.
A volume is a directory that live outside of the container and is mounted onto the filesystem of the container

The data that is stored in that volume persists even if the container exits or crashes.
Volumes could also be used to share data between containers.

Configuration file of a volume:

Below is a configuration file of a pod with a storage volume attached to it:

The volume type could be awsElasticBlockStore, Azue Disk, ...


Leave as a comment: