Skip to content

Replacement for the Kubernetes Pod Security Policy that controls the usage of hostpaths

License

Notifications You must be signed in to change notification settings

kubewarden/hostpaths-psp-policy

Folders and files

NameName
Last commit message
Last commit date
Mar 28, 2025
Aug 12, 2021
Jun 24, 2024
Aug 4, 2021
Feb 7, 2022
Aug 4, 2021
Mar 20, 2025
May 31, 2024
Jul 19, 2022
Jan 26, 2022
Mar 10, 2025
Jun 24, 2024
Dec 3, 2021
Aug 4, 2021
Mar 20, 2025
Feb 17, 2023
Mar 7, 2025
Aug 3, 2023
Aug 10, 2021
Aug 11, 2021
Aug 12, 2021
Mar 29, 2023

Repository files navigation

Kubewarden Policy Repository Stable

psp-hostpaths-policy

Replacement for the Kubernetes Pod Security Policy that controls the usage of hostPath volumes. The policy inspects both the containers and the init containers that are using hostPath volumes.

Settings

allowedHostPaths:
- pathPrefix: "/foo"
  readOnly: true
- pathPrefix: "/bar"
  readOnly: false

allowedHostPaths is a list of host paths that are allowed to be used by hostPath volumes.

An empty allowedHostPaths list means there is no restriction on host paths used.

Each entry of allowedHostPaths must have:

  • A pathPrefix field, which allows hostPath volumes to mount a path that begins with an allowed prefix.
  • a readOnly field indicating it must be mounted read-only.

Special behaviour

It's possible to have host paths sharing part of the prefix. In that case, the readOnly attribute of the most specific path takes precedence.

For example, given the following configuration:

allowedHostPaths:
- pathPrefix: "/foo"
  readOnly: false
- pathPrefix: "/foo/bar"
  readOnly: true

Paths such as /foo/bar/dir1, /foo/bar must be read only.