OKD 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 /host .
apiVersion: v1
kind: Pod
metadata:
name: test-host-mount
spec:
containers:
- image: registry.access.redhat.com/ubi9/ubi
name: test-container
command: ['sh', '-c', 'sleep 3600']
volumeMounts:
- mountPath: /host
name: host-slash
volumes:
- name: host-slash
hostPath:
path: /
type: ''
|