What's the difference between volumeDevices vs volumeMounts with k8s v1.13
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
In Kubernetes, managing storage is a key element, especially when you need to handle stateful applications. Two concepts that are often misunderstood are volumeDevices
and volumeMounts
. Both play crucial roles in connecting containerized applications to storage. Understanding the differences between these two will help users deploy and manage Kubernetes applications effectively.
Overview of volumeDevices
and volumeMounts
volumeMounts
volumeMounts
is the traditional way of mounting persistent storage into containers in Kubernetes. It’s typically used for mounting filesystem-backed volumes and provides a directory into the container's filesystem, where the application can interact with the data:
- name: app-container
- mountPath: /data
- name: app-storage
mountPath: The directory path inside the container where the volume is mounted.name: Refers to the volume specified within the pod’svolumesarray.- name: app-container
- devicePath: /dev/xvda
- name: block-storage
devicePath: Specifies the path in the container to expose the block device.name: LikevolumeMounts, it links to a volume declaration in the pod specification.- Standard Applications: Most applications that require file-based storage will benefit from
volumeMounts. This is especially true for any application that writes or reads files, such as web servers storing media files or databases saving binary logs. - POSIX Compliance: Since
volumeMountsallows files to be accessed and manipulated using standard file system calls, it adheres to POSIX standards, making it ideal for applications expecting this behavior. - Low-level Storage Interfaces: Some applications, like database engines that manage their own storage layers or applications that write data directly to block devices for performance reasons, can make efficient use of
volumeDevices. - Performance: Direct block storage allows applications to bypass the overhead associated with a filesystem, potentially improving I/O performance, crucial for high-performance computing applications.
- Complexity: Using
volumeDevicescan introduce complexity, as applications now need to handle block device operations, which can be non-trivial and error-prone. - Compatibility: Not all applications are suited to handle raw block devices - transitioning an application to use
volumeDeviceswhen designed for filesystem access can require significant engineering effort.

