OpenShift Container Platform supports hostPath mounting for development and testing on a single-node cluster.
In a production cluster, you would not use hostPath. Instead, a cluster administrator would provision a network resource, such as a GCE Persistent Disk volume, an NFS share, or an Amazon EBS volume. Network resources support the use of storage classes to set up dynamic provisioning.
A hostPath volume must be provisioned statically.
Do not mount to the container root,
/, or any path that is the same in the host and the container. This can corrupt your host system if the container is sufficiently privileged. It is safe to mount the host by using
/host. The following example shows the
/ directory from the host being mounted into the container at
- image: registry.access.redhat.com/ubi9/ubi
command: ['sh', '-c', 'sleep 3600']
- mountPath: /host
- name: host-slash