More Info:
The ability to create PersistentVolumes can be used to mount hostPath volumes and access the underlying node. Limit who can create them.Risk Level
MediumAddress
SecurityCompliance Standards
- CIS Kubernetes
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Identify all subjects that can create PersistentVolumes
- Run on: any machine with kubectl access
Save this list of ClusterRoles for review. -
Review the permissions in each identified ClusterRole
- Run on: any machine with kubectl access
For each displayed ClusterRole, decide if thecreatepermission onpersistentvolumesis truly required (e.g., storage admin vs general workloads). -
Map ClusterRoles with PV create permission to actual users/groups/service accounts
- Run on: any machine with kubectl access
Manually review each binding’ssubjectsto see which identities gain PV create capability. -
Decide and implement least-privilege changes
For each ClusterRole wherecreateonpersistentvolumesis NOT strictly needed:- Edit the ClusterRole to remove
create(and*if unused) forpersistentvolumes:- Run on: any machine with kubectl access
In therulessection, removecreatefromverbsforresources: ["persistentvolumes"], or split out a dedicated rule if other verbs are still required.
If an identity needs only PV consumption, bind it instead to a narrower role that lacks PVcreate.
- Edit the ClusterRole to remove
-
If PV creation is needed, confine it to dedicated admin roles
- Ensure only a small, storage-admin–style ClusterRole retains
createonpersistentvolumes. - Rebind ClusterRoleBindings so that:
- General developers and application service accounts do NOT reference that ClusterRole.
- Only designated admin groups/users (e.g., an ops group in your IdP) are subjects of the storage admin ClusterRoleBinding:
Adjust the
subjectslist accordingly.
- Ensure only a small, storage-admin–style ClusterRole retains
-
Verify effective reduction of PV create access
- Re-run the permission discovery and confirm only the intended ClusterRoles retain PV
create: - Optionally, as a non-privileged user/service account, attempt to create a
PersistentVolumeand confirm it is rejected with aforbiddenerror.
- Re-run the permission discovery and confirm only the intended ClusterRoles retain PV
Using kubectl
Using kubectl
Using kubectl
1. List all ClusterRoles that can create PersistentVolumesRun on: any machine withkubectl access.jq, use:Any ClusterRole name returned here grants
create on persistentvolumes to whoever is bound to it. These roles need review to see if that permission is justified.2. Inspect each identified ClusterRole’s rules in detailFor each ClusterRole name from step 1:
rules: section, focusing on entries where:- Roles that are broad (e.g.,
verbs: ["*"]orresources: ["*"]) and includepersistentvolumes. - Roles meant for general users, CI/CD, or application service accounts that also have
createonpersistentvolumeswithout a clear operational need.
3. Discover who actually gets these permissions (ClusterRoleBindings)For each problematic ClusterRole from step 2:
jq:- Bindings that grant the ClusterRole to:
system:authenticated,system:unauthenticated, or large groups (e.g.,developers,ci-users) where most members do not need PV creation.- ServiceAccounts in namespaces unrelated to storage/cluster operations.
- Any binding where you cannot clearly justify why that subject must create PersistentVolumes.
4. Verification after manual changesAfter you have manually updated or removed roles/bindings (via manifests or
kubectl edit), re-run step 1:- If no ClusterRole names are returned, then no ClusterRole currently grants
createonpersistentvolumes. - If only a small, well-justified set of highly privileged operational roles are returned, you must confirm they are appropriate; if not, further manual adjustment is required.
Automation
Automation
- Save as
report-pv-create-access.sh - Make executable:
chmod +x report-pv-create-access.sh - Run:
./report-pv-create-access.sh
- Any
ClusterRoleorRolewhose rules include:resources: persistentvolumeswithverbscontainingcreateor*.
- Especially concerning:
- These roles bound to broad subjects, for example:
kind: Group, name: system:authenticatedkind: Group, name: system:masters(if that group is widely used)- ServiceAccounts used by application workloads rather than storage controllers.
- These roles bound to broad subjects, for example:
- For the summary section, any line like:
cluster-admin -> Group/system:authenticatedsome-pv-manager -> ServiceAccount/default (ns:default)should be reviewed to confirm that subject truly requires PV creation rights.

