1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 06:46:26 +01:00
Files
openshift-docs/modules/persistent-storage-hostpath-pod.adoc

42 lines
1.1 KiB
Plaintext

// Module included in the following assemblies:
//
// * storage/persistent_storage/persistent-storage-hostpath.adoc
[id="persistent-storage-hostpath-pod_{context}"]
= Mounting the hostPath share in a privileged Pod
After the PersistentVolumeClaim has been created, it can be used inside by an application. The following example demonstrates mounting this share inside of a pod.
.Prerequisites
* A PersistentVolumeClaim exists that is mapped to the underlying hostPath share.
.Procedure
* Create a privileged Pod that mounts the existing PersistentVolumeClaim:
+
[source,yaml]
----
apiVersion: v1
kind: Pod
metadata:
name: pod-name <1>
spec:
containers:
...
securityContext:
privileged: true <2>
volumeMounts:
- mountPath: /data <3>
name: hostpath-privileged
...
securityContext: {}
volumes:
- name: hostpath-privileged
persistentVolumeClaim:
claimName: task-pvc-volume <4>
----
<1> The name of the pod.
<2> The Pod must run as privileged to access the node's storage.
<3> The path to mount the hostPath share inside the privileged pod.
<4> The name of the PersistentVolumeClaim that has been previously created.