Which statement correctly describes the difference between a RoleBinding and a ClusterRoleBinding in Kubernetes?
Think about the scope of permissions each binding type controls.
A RoleBinding assigns permissions to users or groups within a single namespace. A ClusterRoleBinding assigns permissions across the entire cluster, spanning all namespaces.
What is the output of the command kubectl get rolebindings -n dev if there is one RoleBinding named read-pods in the dev namespace?
kubectl get rolebindings -n devConsider the resource type and namespace specified in the command.
The command lists RoleBindings in the dev namespace. The output shows the RoleBinding name, the Role it references, and its age.
Which YAML snippet correctly creates a ClusterRoleBinding named cluster-admin-binding that grants the cluster-admin ClusterRole to the user alice?
Check the kind of binding, subject kind, and roleRef kind carefully.
The binding must be ClusterRoleBinding to grant cluster-wide permissions. The subject kind must be User for a user named alice. The roleRef must reference a ClusterRole named cluster-admin.
You try to create a RoleBinding in namespace test that references the cluster-admin ClusterRole, but get an error. What is the most likely cause?
Think about the scope of RoleBindings and ClusterRoles.
RoleBindings can reference Roles or ClusterRoles, but when referencing a ClusterRole, the RoleBinding is limited to the namespace. However, some cluster-wide ClusterRoles like cluster-admin are intended to be bound cluster-wide using ClusterRoleBinding. Some Kubernetes versions or policies may restrict RoleBindings from referencing cluster-wide ClusterRoles.
Arrange the steps in the correct order to grant a user named bob admin rights in the production namespace using Kubernetes RBAC.
Think about prerequisites before creating resources and verifying access last.
First, ensure the namespace exists. Then create the Role with admin permissions. Next, bind the Role to the user with a RoleBinding. Finally, test the user's access.