Definition

Kubernetes volume

Contributor(s): Alan Earls

A Kubernetes volume is a directory that contains data accessible to containers in a given Pod in the orchestration and scheduling platform. Volumes provide a plug-in mechanism to connect ephemeral containers with persistent data stores elsewhere.

Kubernetes volumes persist until the Pod -- Kubernetes's atomic unit of container deployment -- is deleted. When a Pod with a unique identification is deleted, the volume associated with it gets destroyed. If a Pod is deleted but replaced with an identical Pod, a new and identical volume is also created. No matter what Node -- a logical grouping of host resources -- the Pod runs on, Kubernetes will mount the Pod's volumes to it, allowing containers to move across infrastructure without losing access to the externally hosted data that they require for the workload.

The data within a volume outlasts the containers running in the Pod, which can shut down and restart as ephemeral units. Data remains safe in volumes even if a container crashes, because a container crash is not enough to cut off a Pod from a Node. A Pod specifies what volumes it will access, and where the volume will be placed in the containers.

Volumes cannot be added to other volumes and links do not exist between volumes. The Kubernetes user must specify volume mounting for each container in a Pod. A representation of each Pod's desired state -- what it should be and its volumes -- is stored in Kubernetes's API server and central controller. Kubernetes also uses its kubelet agents to reconcile deployments. For example, if a volume cannot be used twice, the kubelet will detect this and report that it cannot safely use the volume, and retry and reevaluate deployment options through the scheduler until one is ready that meets the requirements.

Types of Kubernetes volumes

Kubernetes supports more than 20 types of volumes. One common example is the emptyDir volume, created when a Pod is first assigned to a Node. The volume is initially empty, with all containers in the Pod able to read from it. This emptyDir volume allows users to mount multiple paths in each container. Another example of a common volume is hostPath, which mounts a directory from the host node's filesystem into a Pod.

A local volume can represent mounted local storage devices such as partitions, directories or disks.

Specialty volumes are used to mount platform-specific volumes into containers. Examples include AzureFileVolume and AzureDiskVolume for the Microsoft Azure public cloud, and vsphereVolume for VMware virtualized environments.  

In some situations, it is helpful to share one volume across multiple uses in one Pod. Kubernetes contains a property, volumeMounts.subPath, to specify a subpath inside the referenced volume.

This was last updated in November 2017

Continue Reading About Kubernetes volume

Dig Deeper on Managing Virtual Containers

PRO+

Content

Find more PRO+ content and other member only offers, here.

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

What types of applications does your IT organization run in containers?
Cancel

-ADS BY GOOGLE

File Extensions and File Formats

Powered by:

SearchDataCenter

SearchAWS

SearchServerVirtualization

SearchCloudApplications

SearchCloudComputing

DevOpsAgenda

Close