Inspecting Existing Cluster Roles
Begin by examining the currently defined cluster roles in your cluster. These roles includecluster-admin, system-specific roles, and others. Run the following command to list them:
wc -l. For example:
Cluster roles are cluster-scoped and are not limited to any namespace.
Inspecting Cluster Role Bindings
Next, verify the cluster role bindings by counting them with the following command:Both cluster roles and cluster role bindings are applied across the entire cluster and are not namespace-specific.
Reviewing Cluster Admin Role Bindings
Thecluster-admin role represents the highest permission level and is bound to specific user groups via a ClusterRoleBinding. To identify the binding for the cluster-admin role, run:
cluster-admin role is bound by default to the system:masters group, thereby granting all possible operations (denoted by [*] for all actions on all resources).
Exercise caution when modifying cluster roles as they affect permissions across the entire cluster.
Granting Node Access to a New User (Michelle)
Michelle, a new team member, requires access to manage nodes. Initially, when Michelle runs:Create the Cluster Role for Node Access
Create a cluster role namedmichelle-role that allows Michelle to get, list, and watch nodes:
Bind the Cluster Role to Michelle
Bind the role to Michelle’s user account with:Expanding Michelle’s Responsibilities to Storage
Michelle’s roles are expanding to include storage management. To grant her access to storage-related resources, first verify the available API resources by running:Create a Cluster Role for Storage Administration
Create a cluster role namedstorage-admin that allows listing, creating, getting, and watching persistent volumes and storage classes:
Bind the Storage Admin Role to Michelle
Bind thestorage-admin role to Michelle with the following command:
This concludes the lesson on inspecting, creating, and binding cluster roles and cluster role bindings. By following these steps, you learned how to review existing roles, grant specific permissions to a user, and expand those permissions as job responsibilities change.