Professional Documents
Culture Documents
What Is A Kubernetes Volume
What Is A Kubernetes Volume
A Kubernetes volume persists until its associated pod is deleted. When a pod with a
unique identification is deleted, the volume associated with it is destroyed. If a pod is
deleted but replaced with an identical pod, a new and identical volume is also created.
A pod specifies which volumes it will access and where to place the volumes in its
containers. The data within a volume outlasts the containers running in the pod, which
can shut down and restart as ephemeral units. Because a container crash is not enough
to cut off a pod from a node, data remains safe in volumes even if a container crashes.
Although
container instances themselves are ephemeral, container orchestrators like Kubernetes offer ways
to implement persistent storage for stateful applications.
Volumes cannot be added to other volumes, and links do not exist between volumes.
Kubernetes users must specify volume mounting for each container in a pod. A
representation of each pod's desired state, including its volumes, is stored in
Kubernetes' API server and central controller.
Kubernetes also reconciles deployments using kubelet, an agent that runs on each
node in a cluster. For example, kubelet can detect whether a volume cannot be used
twice and report that it cannot safely use the volume. It then retries and reevaluates
deployment options using the Kubernetes scheduler until it finds one that meets the
requirements.
In some situations, it is helpful to share one volume across multiple uses in a single
pod. The Kubernetes property volumeMounts.subPath lets users specify a
subpath inside the referenced volume.