More Info:
Kubernetes Roles and ClusterRoles provide access to resources based on sets of objects and actions that can be taken on those objects. It is possible to set either of these to be the wildcard * which matches all items.Risk Level
MediumAddress
SecurityCompliance Standards
- CIS Kubernetes
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Identify all noncompliant Roles and ClusterRoles (run on any machine with kubectl access):
-
For each NONCOMPLIANT Role, review who uses it and what it truly needs (run on any machine with kubectl access):
Decide, based on actual application requirements, which
resources,resourceNames, andverbsare needed instead of"*". -
Edit each NONCOMPLIANT Role to replace
"*"with specific resources/verbs (run on any machine with kubectl access):In the editor, locaterules:and replace fields like:with the minimal specific lists required, for example:Save and exit to apply the changes. -
For each NONCOMPLIANT ClusterRole, review usage and scope (run on any machine with kubectl access):
Decide the minimal
apiGroups,resources,resourceNames, andverbsneeded instead of"*". -
Edit each NONCOMPLIANT ClusterRole to remove wildcards where possible (run on any machine with kubectl access):
In the editor, under
rules:, replace any"*"values with specific items as in step 3. If a particular wildcard is truly required (e.g., an administrative role), document the justification outside the manifest for security review. -
Verify that Roles and ClusterRoles no longer contain wildcard-only lists (run on any machine with kubectl access):
The configuration is compliant when no Roles or ClusterRoles you intend to harden are reported as still noncompliant.
Using kubectl
Using kubectl
On any machine with kubectl access:Repeat for each affected Role and ClusterRole.
- Identify the non‑compliant Roles and ClusterRoles
- Export each non‑compliant object and edit it locally to remove
"*"and replace with the minimum required verbs/resources (this is a manual, least‑privilege design decision):
- In each exported YAML:
- For
rules[].verbs, replace- "*"with explicit verbs, e.g.:
- For
rules[].resources, replace- "*"with explicit resources, e.g.:
- For
rules[].apiGroups/rules[].resourceNames, similarly avoid"*"and specify concrete values when possible.
- Apply the edited manifests back to the cluster
- Verification
role_is_compliant and clusterrole_is_compliant values are true:Automation
Automation

