Skip to main content

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

Medium

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. Identify all noncompliant Roles and ClusterRoles (run on any machine with kubectl access):
  2. 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, and verbs are needed instead of "*".
  3. Edit each NONCOMPLIANT Role to replace "*" with specific resources/verbs (run on any machine with kubectl access):
    In the editor, locate rules: and replace fields like:
    with the minimal specific lists required, for example:
    Save and exit to apply the changes.
  4. For each NONCOMPLIANT ClusterRole, review usage and scope (run on any machine with kubectl access):
    Decide the minimal apiGroups, resources, resourceNames, and verbs needed instead of "*".
  5. 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.
  6. 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.
On any machine with kubectl access:
  1. Identify the non‑compliant Roles and ClusterRoles
  1. 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):
  1. 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.
  1. Apply the edited manifests back to the cluster
Repeat for each affected Role and ClusterRole.
  1. Verification
Re‑run the audit and confirm all role_is_compliant and clusterrole_is_compliant values are true: