1 # Local Storage Provisioner
3 The [local storage provisioner](https://github.com/kubernetes-incubator/external-storage/tree/master/local-volume)
4 is NOT a dynamic storage provisioner as you would
5 expect from a cloud provider. Instead, it simply creates PersistentVolumes for
6 all mounts under the host_dir of the specified storage class.
7 These storage classes are specified in the `local_volume_provisioner_storage_classes` nested dictionary.
11 local_volume_provisioner_storage_classes:
16 host_dir: /mnt/fast-disks
17 mount_dir: /mnt/fast-disks
18 block_cleaner_command:
21 volume_mode: Filesystem
25 For each key in `local_volume_provisioner_storage_classes` a storageClass with the
26 same name is created. The subkeys of each storage class are converted to camelCase and added
27 as attributes to the storageClass.
28 The result of the above example is:
37 hostDir: /mnt/fast-disks
38 mountDir: /mnt/fast-disks
42 volumeMode: Filesystem
46 The default StorageClass is local-storage on /mnt/disks,
47 the rest of this doc will use that path as an example.
49 ## Examples to create local storage volumes
54 for vol in vol1 vol2 vol3; do
56 mount -t tmpfs -o size=5G $vol /mnt/disks/$vol
60 The tmpfs method is not recommended for production because the mount is not
61 persistent and data will be deleted on reboot.
63 1. Mount physical disks
67 mount /dev/vdb1 /mnt/disks/ssd1
70 Physical disks are recommended for production environments because it offers
71 complete isolation in terms of I/O and capacity.
73 1. Mount unpartitioned physical devices
76 for disk in /dev/sdc /dev/sdd /dev/sde; do
77 ln -s $disk /mnt/disks
81 This saves time of precreating filesystems. Note that your storageclass must have
82 volume_mode set to "Filesystem" and fs_type defined. If either is not set, the
83 disk will be added as a raw block device.
85 1. File-backed sparsefile method
88 truncate /mnt/disks/disk5 --size 2G
89 mkfs.ext4 /mnt/disks/disk5
91 mount /mnt/disks/disk5 /mnt/disks/vol5
94 If you have a development environment and only one disk, this is the best way
95 to limit the quota of persistent volumes.
99 In a development environment using `mount --bind` works also, but there is no capacity
102 1. Block volumeMode PVs
104 Create a symbolic link under discovery directory to the block device on the node. To use
105 raw block devices in pods, volume_type should be set to "Block".
109 Beta PV.NodeAffinity field is used by default. If running against an older K8s
110 version, the useAlphaAPI flag must be set in the configMap.
112 The volume provisioner cannot calculate volume sizes correctly, so you should
113 delete the daemonset pod on the relevant host after creating volumes. The pod
114 will be recreated and read the size correctly.
116 Make sure to make any mounts persist via /etc/fstab or with systemd mounts (for
117 Flatcar Container Linux). Pods with persistent volume claims will not be
118 able to start if the mounts become unavailable.
122 Refer to the upstream docs here: <https://github.com/kubernetes-incubator/external-storage/tree/master/local-volume>