Add a new persistent volume to the provisioner
The local volume provisioner works like this (taken from the official local volume provisioner documentation):
“The discovery routine periodically reads the configured discovery directories and looks for new mount points that don’t have a PV, and creates a PV for it.”
The provisioner is configured with /opt/bitnami/kubernetes/localvolumes as the discovery directory. By default it includes 10 subfolders, so the provisioner creates 10 Persistent Volumes (PV), all of them using the local filesystem. For adding new volumes, there are two choices: use the VM’s filesystem or an external filesystem.
Option 1: Volume from the VM filesystem
This is the easiest option, but it is limited to the virtual machine filesystem maximum space.
-
Create a new subfolder in /opt/bitnami/kubernetes/localvolumes/ (the subfolder name is irrelevant):
$ sudo mkdir /opt/bitnami/kubernetes/localvolumes/new_volume
-
Check that a new volume is available by executing this command.
$ kubectl get pv NAME CAPACITY ... ... <new_volume_id> <vm_size> ...
Option 2: Volume from an external disk
NOTE: We assume that the external disk is located in /dev/sdb1.
You can also mount an external disk so it is used as a persistent volume. This is useful to overcome the VM space limitations.
-
Mount the external disk as a subfolder in /opt/bitnami/kubernetes/localvolumes/ (the subfolder name is irrelevant):
$ sudo mount /dev/sdb1 /opt/bitnami/kubernetes/localvolumes/new_volume