Understanding Kubernetes volumes, the CSI driver, and storage on AWS
The basic storage object within Kubernetes is a volume, which represents a directory (with or without data) that can be accessed by containers in a Pod. You can have ephemeral volumes that persist over container restarts but are aligned to the lifetime of the Pod and are destroyed by the Kubernetes scheduler when the Pod is destroyed. Persistent volumes are not destroyed by Kubernetes and exist separately from the Pod or Pods that use them.
The simplest example of an ephemeral volume is an emptyDir
volume type. An example is shown next, which mounts host storage inside the containers using the mountPath
key. As both containers use the same volume, they see the same data despite the fact it’s mounted onto different mount points. When a Pod dies, crashes, or is removed from a node, the data in the emptyDir
volume is deleted and lost:
apiVersion: v1 kind: Pod metadata: name: empty-dir-example...