Skip to main content

More Info:

Verifies no ServiceAccount is bound to the cluster-admin ClusterRole. Such a binding hands full cluster control to any workload using that account.

Risk Level

Critical

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. List all ClusterRoleBindings that bind ServiceAccounts to cluster-admin (run on any machine with kubectl access):
  2. For each violating ServiceAccount, review what it actually needs to do (on any machine with kubectl access):
    • Inspect workloads using the ServiceAccount:
    • Replace SERVICEACCOUNT_NAME with the name from step 1, and note the namespaces and pods.
  3. Design and create a minimally-privileged Role/ClusterRole that grants only the necessary permissions (on any machine with kubectl access). Example template (edit apiGroups, resources, verbs, and scope before applying):
    If access is only needed within one namespace, change kind: ClusterRole to kind: Role and add metadata.namespace: TARGET_NAMESPACE.
  4. Bind the ServiceAccount to the new limited Role/ClusterRole (on any machine with kubectl access). Adjust names and namespace as needed:
    For namespace-scoped permissions instead, use:
  5. Remove the insecure cluster-admin binding once you have confirmed workloads still function as expected (on any machine with kubectl access). For each violating ClusterRoleBinding name from step 1:
  6. Verify no ServiceAccount is bound to cluster-admin anymore (on any machine with kubectl access):
    Compliance is achieved when the output is exactly:
On any machine with kubectl access:
  1. Identify ServiceAccounts bound to cluster-admin:
  1. For each violating ClusterRoleBinding, inspect it to understand what it’s used for:
  1. (Optional but recommended) Create a narrowly-scoped Role/ClusterRole and binding for the workload, based on its actual needs. Example pattern (replace placeholders with real values):
Namespace-scoped permissions:
Cluster-scoped permissions (only if truly required):
Apply your minimal RBAC:
  1. Delete the ClusterRoleBinding that grants cluster-admin to a ServiceAccount:
Repeat for every offending binding reported by the audit.
  1. Verification (cluster is compliant when only is_compliant=true is printed):