What's the difference between volumeDevices vs volumeMounts with k8s v1.13
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
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.
Related reading
- What's the maximum number of Kubernetes namespaces?
- What's the meaning of READY2/2 output by command kubectl get pod yourpod
- What's the most elegant/right way to stop a spark job running on a Kubernetes cluster?
- When does Kafka Leader Election happen?
- What's the recommended way of iterating a container in C11?
- What''s the target group port for, when using Application Load Balancer EC2 Container Service
- When exactly do I set an ownerReference's controller field to true?
- When I run sudo minikube start --vm-drivernone it gives me error

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.