// Module included in the following assemblies:
//
// storage/persistent_storage/persistent-storage-flexvolume.adoc

[id="flexvolume-installing_{context}"]

= Installing FlexVolume drivers

FlexVolume drivers that are used to extend {product-title} are executed only on the node. To implement FlexVolumes, a list of operations to call and the installation path are all that is required.

.Prerequisites

* FlexVolume drivers must implement these operations:

`init`::
Initializes the driver. It is called during initialization of all nodes.

** Arguments: none
** Executed on: node
** Expected output: default JSON

`mount`::
Mounts a volume to directory. This can include anything that is necessary to mount the volume, including finding the device and then mounting the device.

** Arguments: `<mount-dir>` `<json>`
** Executed on: node
** Expected output: default JSON

`unmount`::
Unmounts a volume from a directory. This can include anything that is necessary to clean up the volume after unmounting.

** Arguments: `<mount-dir>`
** Executed on: node
** Expected output: default JSON

`mountdevice`::
Mounts a volume's device to a directory where individual pods can then bind mount.

This call-out does not pass "secrets" specified in the FlexVolume spec. If your driver requires secrets, do not implement this call-out.

** Arguments: `<mount-dir>` `<json>`
** Executed on: node
** Expected output: default JSON

`unmountdevice`::
Unmounts a volume's device from a directory.

** Arguments: `<mount-dir>`
** Executed on: node
** Expected output: default JSON

* All other operations should return JSON with `{"status": "Not supported"}` and exit code `1`.

.Procedure

To install the FlexVolume driver:

. Ensure that the executable file exists on all nodes in the cluster.

. Place the executable file at the volume plug-in path:
*_/etc/kubernetes/kubelet-plugins/volume/exec/<vendor>~<driver>/<driver>_*.

For example, to install the FlexVolume driver for the storage `foo`, place the
executable file at:
*_/etc/kubernetes/kubelet-plugins/volume/exec/openshift.com~foo/foo_*.
