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
CriticalAddress
SecurityCompliance Standards
- Cloudanix Best Practice
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
List all ClusterRoleBindings that bind
cluster-adminto any ServiceAccount (run on any machine withkubectlaccess): -
For each violating ServiceAccount identified in step 1, review what permissions it actually needs by inspecting the workloads that use it (run on any machine with
kubectlaccess). ReplaceVIOLATING_NAMESPACEandVIOLATING_SAwith actual names: -
Define a narrowly-scoped Role or ClusterRole that grants only the minimal verbs/resources required by those workloads (run on any machine with
kubectlaccess). Example template to save asminimal-role.yamland edit for correctnamespace,apiGroups,resources, andverbs:Apply it: -
Bind the violating ServiceAccount to the new narrowly-scoped Role or ClusterRole (run on any machine with
kubectlaccess). Example for a namespaced Role: -
After confirming that workloads still function with the new, reduced privileges, remove the ClusterRoleBinding that granted
cluster-adminto that ServiceAccount (run on any machine withkubectlaccess). ReplaceCLUSTERROLEBINDING_NAMEwith the name from step 1: -
Verification (run on any machine with
kubectlaccess): confirm that no ServiceAccount is bound tocluster-adminand that the check now reports compliance:
Using kubectl
Using kubectl
On any machine with kubectl access:Note the Apply it:For cluster-scoped access, use You can delete multiple at once:
- Identify violating ClusterRoleBindings
name= of each violating ClusterRoleBinding.- (Optional but recommended) Create a narrowly-scoped Role/ClusterRole and binding
Adapt the following to the actual verbs and resources the workload requires.
my-sa in namespace my-namespace:ClusterRole and ClusterRoleBinding instead of Role/RoleBinding.- Delete ClusterRoleBindings that bind ServiceAccounts to
cluster-admin
BINDING_NAME with the actual name):- Verification
is_compliant=true:Automation
Automation

