Skip to content

Commit d26f9ac

Browse files
authored
Merge pull request #28252 from tallclair/hostpath
Copy PSP hostpath warning to hostpath volume docs
2 parents 9409672 + 6d0d8c0 commit d26f9ac

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

content/en/docs/concepts/storage/volumes.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,15 @@ See the [GlusterFS example](https://github.com/kubernetes/examples/tree/{{< para
529529

530530
### hostPath {#hostpath}
531531

532+
{{< warning >}}
533+
HostPath volumes present many security risks, and it is a best practice to avoid the use of
534+
HostPaths when possible. When a HostPath volume must be used, it should be scoped to only the
535+
required file or directory, and mounted as ReadOnly.
536+
537+
If restricting HostPath acccess to specific directories through AdmissionPolicy, `volumeMounts` MUST
538+
be required to use `readOnly` mounts for the policy to be effective.
539+
{{< /warning >}}
540+
532541
A `hostPath` volume mounts a file or directory from the host node's filesystem
533542
into your Pod. This is not something that most Pods will need, but it offers a
534543
powerful escape hatch for some applications.
@@ -558,6 +567,9 @@ The supported values for field `type` are:
558567

559568
Watch out when using this type of volume, because:
560569

570+
* HostPaths can expose privileged system credentials (such as for the Kubelet) or privileged APIs
571+
(such as container runtime socket), which can be used for container escape or to attack other
572+
parts of the cluster.
561573
* Pods with identical configuration (such as created from a PodTemplate) may
562574
behave differently on different nodes due to different files on the nodes
563575
* The files or directories created on the underlying hosts are only writable by root. You

0 commit comments

Comments
 (0)