LocalVolume
最后更新于
最后更新于
Heads-up: This feature is only supported in v1.7 and onwards, and was upgraded to beta in v1.10.
LocalVolume is your bridge to local storage devices - be it a disk, partition, or even a humble directory. It's most at home in high-performance, high-reliability environments like distributed storage and databases. It can work smoothly with both block devices and file systems, and you can point it to the right place using spec.local.path
. Don't sweat about space restrictions for file systems; Kubernetes won't impose any limits.
However, LocalVolumes can only play with statically provisioned Persistent Volumes (PVs). Compared to , these data volumes are always available for use, since they always land on a specified node thanks to NodeAffinity.
Community developers have also crafted a , for automating the creation and cleanup of local data volumes.
Below is a StorageClass:
And here's how you create a local data volume on a hostname named example-node
:
Creation of PVC:
Pod creation, referencing PVC:
As of the moment, you can't bind multiple PVCs of local data volumes to one Pod (but it's on the to-do list for v1.9).
Scheduling conflicts might happen, especially when there's a shortage of CPU or memory resources (v1.9 aims to tackle this).
The external Provisioner has some trouble detecting the size of a mount point right after starting up (the v1.9 update is expected to bring Mount Propagation feature to solve this).
For optimal IO isolation, consider allocating a separate disk for each storage volume.
It's advisable to allocate separate partitions for each storage volume to isolate storage space.
Avoid creating Nodes under the same name to prevent new Nodes from identifying PVs already bound to the old Nodes.
Instead of file paths, it's recommended to use UUIDs to eliminate mismatch issues.
For block storage without file systems, opt for unique IDs, like /dev/disk/by-id/
, to circumvent block device path mismatch problems.
For a more in-depth look, check out the .