Local Storage support for the Percona Operator for MongoDB¶
Among the wide rage of volume types, supported by Kubernetes, there are two volume types which allow Pod containers to access part of the local filesystem on the node the emptyDir and hostPath.
A Pod emptyDir volume is created when the Pod is assigned to a Node. The volume is initially empty and is erased when the Pod is removed from the Node. The containers in the Pod can read and write the files in the emptyDir volume.
emptyDir options in the deploy/cr.yaml
file can be used to turn the emptyDir volume on by setting the directory name.
emptyDir is useful when you use Percona Memory Engine.
A hostPath volume mounts an existing file or directory from the host node’s filesystem into the Pod. If the pod is removed, the data persists in the host node’s filesystem.
volumeSpec.hostPath subsection in the
file may include
type keys to set the node’s filesystem object
path and to specify whether it is a file, a directory, or something else (e.g.
volumeSpec: hostPath: path: /data type: Directory
Please note, you must created the hostPath manually and should have following attributes:
- access permissions,
- SELinux security context.
hostPath volume is useful when you perform manual actions
during the first run and require improved disk performance.
Consider using the tolerations settings to avoid a cluster migration to
different hardware in case of a reboot or a hardware failure.
More details can be found in the official hostPath Kubernetes documentation.